Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <SPI.h> // needed in Arduino 0019 or later
  2. #include <WiFi.h>
  3. #include <Twitter.h>
  4.  
  5. char ssid[] = "Micromax A52"; // your network SSID (name)
  6. char pass[] = "password"; // your network password
  7.  
  8. // Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
  9. Twitter twitter("Your token here");
  10.  
  11. // Message to post
  12. char msg[] = "Automatic tweet!";
  13.  
  14. void setup()
  15. {
  16. delay(1000);
  17. WiFi.begin(ssid, pass);
  18. // or you can use DHCP for automatic IP address configuration.
  19. // WiFi.begin(mac);
  20. delay(10000);
  21. Serial.begin(9600);
  22.  
  23. Serial.println("connecting ...");
  24. if (twitter.post(msg)) {
  25. // Specify &Serial to output received response to Serial.
  26. // If no output is required, you can just omit the argument, e.g.
  27. // int status = twitter.wait();
  28. int status = twitter.wait(&Serial);
  29. if (status == 200) {
  30. Serial.println("OK.");
  31. } else {
  32. Serial.print("failed : code ");
  33. Serial.println(status);
  34. }
  35. } else {
  36. Serial.println("connection failed.");
  37. }
  38. }
  39.  
  40. void loop()
  41. {
  42. }