Twittering Laser Tripwire with Webcam Capture

Step 4Processing

Processing

Load the Processing sketch and leave this line commented out:
//open("/home/your_usename/twitter.trip");

Make sure that your laser is pointed at the LDR and run the sketch. The screen area should be green and when you block the laser it should turn red, then after 10 seconds it should turn back to green.

The 10 second hold is to ensure that you're not twittering the same message multiple times, you can change this value by modifying the "int threshold=10000" variable.

Now that everything is working it's time to get your scripts in place

put twitter.trip into:
/home/your_username/

Change these to your twitter username and password
user="name"
pass="password"


open up a terminal and type:
chmod a+x /home/your_username/twitter.trip

then run it
./twitter.trip

go to your twitter page and you should see "laser tripped on..." as your last tweet.

Now time to get the webcam working, you can skip this step if you don't want to use a webcam or if you know how to grab a frame from a webcam in linux via script.

First you want to make sure that the program called "webcam" is installed, it's a part of xawtv.

Arch Linux: pacman -S xawtv
Fedora: yum install xawtv
Debian/Ubuntu: apt-get install xawtv

Then configure .webcamrc however you need, mine is below.
The best part about webcam is that it has ftp support so that the image can be uploaded to a webserver, if you don;t want FTP comment that part out.

.webcamrc in /home/your_username/

[grab]
device = /dev/video0
text="%Y-%m-%d %H:%M:%S"
#infofile = filename
fg_red = 0
fg_green = 0
fg_blue = 0
fg_red = 255
fg_green = 255
fg_blue = 255
width = 320
height = 240
delay = 0
wait = 0
input = pac207
#norm = pal
rotate = 0
top = 0
left = 0
bottom = -1
right = -1
quality = 75
trigger = 0
once = 1
archive = /home/action-owl/webcam/%Y-%m-%d--%H:%M:%S.jpg

[ftp]
host = ftp.yourwebsite.com
user = username
pass = password
dir  = public_html/img/webcam
file = webcam.jpg
tmp  = uploading.jpg
passive = 1
debug = 1
auto = 0
local = 0
ssh = 0

« Previous StepDownload PDFView All StepsNext Step »
2 comments
Dec 1, 2011. 7:22 AMriddik001 says:
"put twitter.trip into:
/home/your_username/" where do i find the /home/my-username? folder ? and which software i will use the arduino or processing to load the script thanks.
Dec 24, 2011. 3:18 PMdudesurge says:
you answered your own question, you find it in the HOME folder, as for the other question you can get the software from arduino.cc under downloads
Feb 19, 2011. 11:40 PMpolishdude says:
can you do this with windows?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
36
Followers
4
Author:action_owl