Elementix Posted May 7, 2010 Share Posted May 7, 2010 (edited) Hey guys, here's some code to auto-post a facebook status. Not sure of why you'd want to have the same status posted every time you plug in the teensy, but maybe someone else can build on it. Feel free to contribute to it. Cheers! :) // Facebook Status Updater - Teensy // Based on vulg4h's Facebook script and iann0036's IP to Twitter script - 5/7/2010 - 2:41PM int ledPin = 11; void setup() { pinMode(ledPin, OUTPUT); // put this before other led commands or the LED will be dim ledstart(); // lights up when connected delay(3000); // delay for computer ledstart(); // lights up when payload starts Keyboard.set_modifier(MODIFIERKEY_GUI); Keyboard.send_now(); Keyboard.set_key1(KEY_R); Keyboard.send_now(); Keyboard.set_key2(0); Keyboard.send_now(); d(); // this is a 100ms delay, see below for commands. Keyboard.print("http://facebook.com"); // goes to facebook d(); enter(); delay(6000); // delay for browser to load Keyboard.set_key2(KEY_TAB); Keyboard.send_now(); Keyboard.print("FACEBOOK USERNAME"); Keyboard.send_now(); d(); Keyboard.set_key2(KEY_TAB); Keyboard.send_now(); d(); Keyboard.print("FACEBOOK PASSWORD"); Keyboard.send_now(); enter(); delay(9000); // let browser load Keyboard.set_modifier(MODIFIERKEY_CTRL); // set browser to search-page Keyboard.set_key1(KEY_F); sendClearKeys(); delay(100); Keyboard.print("What's on"); // search for "What's on" Keyboard.set_key1(KEY_ESC); // escape search sendClearKeys(); delay(100); Keyboard.set_key1(KEY_DELETE); sendClearKeys(); delay(100); Keyboard.set_key1(KEY_DELETE); sendClearKeys(); delay(100); Keyboard.print("FACEBOOK STATUS TO BE POSTED"); // new status content delay(100); Keyboard.set_key1(KEY_TAB); sendClearKeys(); enter(); } void loop() { // Maybe a flashing LED? } void enter() { Keyboard.set_key1(KEY_ENTER); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.send_now(); } void sendClearKeys() { Keyboard.send_now(); Keyboard.set_modifier(0); Keyboard.set_key1(0); Keyboard.send_now(); } // LED command for end of script. void ledend(){ Keyboard.set_key1(0); Keyboard.set_key2(0); Keyboard.set_modifier(0); Keyboard.send_now(); digitalWrite(ledPin, HIGH); delay (500); digitalWrite(ledPin, LOW); delay (500); digitalWrite(ledPin, HIGH); delay (500); digitalWrite(ledPin, LOW); } // LED command for start of script void ledstart(){ digitalWrite(ledPin, HIGH); delay (1000); digitalWrite(ledPin, LOW); } // delay 100ms void d(){ delay(100); } Edited May 7, 2010 by Elementix Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.