Button that Tweets

Using arduino and processing, I made a button that will tweet the exact hour, minute, and second that it is pushed.

Screen Shot 2014-11-17 at 7.56.29 PM

 

The tweet from the video ^^^~^^~^^~^^~^^^

Arduino Code:


//Will Taylor - Tweeting App

// Create a session using your Temboo account application details
TembooSession session = new TembooSession("willtaylorvisual", "myFirstApp", "9eeb4f289ddf4ae28ab9426f0956347d");

import com.temboo.core.*;
import com.temboo.Library.Twitter.Tweets.*;
import processing.serial.*;
ArrayList serialChars;
Serial myPort;

void setup() {
// List my available serial ports
int nPorts = Serial.list().length;
for (int i=0; i < nPorts; i++) {
println("Port " + i + ": " + Serial.list()[i]);
}

String portName = Serial.list()[5];
myPort = new Serial(this, portName, 9600);
serialChars = new ArrayList();
}

void processSerial() {

while (myPort.available () > 0) {
char aChar = (char) myPort.read();

// You'll need to add a block like one of these
// if you want to add a 3rd sensor:
if (aChar == 'A') {
// Run the StatusesUpdate Choreo function
println("You did it you piece of shit! Good fucking job!");
runStatusesUpdateChoreo();
}
}
}

void runStatusesUpdateChoreo() {
// Create the Choreo object using your Temboo session
StatusesUpdate statusesUpdateChoreo = new StatusesUpdate(session);

// Set inputs
statusesUpdateChoreo.setAccessToken("2774482314-jR8gqVBzWk08Wh4SEpsmTZazMT7i4MBVHAP5fwl");
statusesUpdateChoreo.setAccessTokenSecret("2GUsUWfMBAdXLadA1XjATxHzJB8e5AMQxWtyofGRRNiTf");
statusesUpdateChoreo.setConsumerSecret("7KMu4Ky2OAFtmmDpepEeemlgozoomvd2tAIq98lrdzFAbdiuPY");
statusesUpdateChoreo.setStatusUpdate("Test tweet for status update app! Button pushed @ " + hour() + ":" + minute() + "." + second());
statusesUpdateChoreo.setConsumerKey("TSake54GKJUnG9bugX3NAhkbJ");

// Run the Choreo and store the results
StatusesUpdateResultSet statusesUpdateResults = statusesUpdateChoreo.run();

// Print results
println(statusesUpdateResults.getResponse());

}

void draw(){
processSerial();
}

 

Processing Code:


// Will Taylor - Tweeting App Arduino

const int buttonPin = 9;
int buttonValue = 0;
boolean tweet = false;
void setup() {
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}

void loop() {
buttonValue = digitalRead(buttonPin);
if (buttonValue == HIGH && tweet == false){
Serial.println("A");
tweet = true;
} else {
Serial.println("B");
tweet = false;
}

delay(100);

}

 

 

Comments are closed.