Step 6Now run it.
Now everything should be ready to go!
Run the processing sketch and check your twitter and webcam archive location for the result.
Something is up with the file downloads.
So here's the code, again.
#------------------------
# twitter.trip
#------------------------
#!/bin/bash
user="username"
pass="password"
trip=$( date +'%A %b %d, %l:%M%p' )
stat="laser tripped: "$trip
url=http://twitter.com/statuses/update.xml
result=`curl -u $user:$pass -d status="$stat" $url`
#save webcam pic
webcam
date +'%A %b %d, %l:%M%p' > /home/username/someplace
//------------------------
// processing code
//------------------------
import processing.serial.*;
Serial myPort;
char inBuffer;
int wait, now, timeout = 10000;
boolean hold = false;
void setup() {
size(200,200);
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
fill(#36ff00);
}
void draw() {
while (myPort.available() > 0)
{
inBuffer = myPort.readChar();
if(inBuffer=='1')
{
if ( !hold )
{
fill(#ff0000);
println("Tripped");
open("/home/username/someplace/twitter.trip");
wait = millis();
hold = true;
}
}
}
now = millis();
if (now > (wait + timeout))
{
hold = false;
fill(#36ff00);
}
rect(0,0,200,200);
}
//------------------------
// arduino code
//------------------------
int ledPin = 13;
int analogPin = 0;
int ldrVal = 0;
int threshold = 500;
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
}
void loop()
{
ldrVal = analogRead(analogPin);
if ( ldrVal > threshold )
{
Serial.print("1");
delay(200);
}
}
| « Previous Step | Download PDFView All Steps | Next Step » |








































User SuperTweet.net instead. Youre still using curl but supertweet.net acts as a proxy between you and twitter, allowing you to use basic auth. Twitter now uses oAuth which is a pain. For the code below, use your SuperTweet username and password, it is separate from your twitter login.
#!/bin/bash
trip=$(date +'%A %n %d, %l:%M%p' )
stat="["$trip"] Door has been opened"
curl -u USERNAME:PASSWORD -d "status=$stat" http://api.supertweet.net/1/statuses/update.xml --insecure