Pages: [1]   Go Down
Author Topic: arduino twitter Help  (Read 231 times)
0 Members and 1 Guest are viewing this topic.
Malaysia
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Stay calm and call batman!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, im experimenting on using the Serial monitor to upload strings on twitter,  i have written a code that fetches user input string but some reason, it doesn't work, code compiles fine..need some help to debug!

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <Twitter.h>

boolean MsgSent = false;
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {192, 168, 2, 50 };
Twitter twitter("XXXXX");

EthernetClient client;

char msg[140];
int delayS = 10;

void softReset() {
  asm volatile ("jmp 0");
}

void setup() {
   
  Serial.begin(9600);   
  if (Ethernet.begin(mac) == 0)
{
    Serial.println("Failed to configure Ethernet using DHCP"); 
    while(true); 
  }

 Serial.println("type in what you wanna tweet");
 
}

void loop() {
char tweet;
int i =0;
tweet = Serial.read() ;
  if(Serial.available() > 0) {
    snprintf(msg, 140, "%c" , tweet);
    i++;
    Serial.println("Delaying ...");
    for(int i = 0; i < delayS; i++) {
      delay(1000);
      Serial.print(i);
      Serial.print(" ");
    }
    Serial.println();
    Serial.println("connecting ...");
    if (twitter.post(msg)) {

      int status = twitter.wait(&Serial);
      if (status == 200) {
        Serial.println("OK.");
      }
      else {
        Serial.print("failed : code ");
        Serial.println(status);
        Serial.print("\n");
      }
      softReset();
    }
  }


}


Cheers!!
Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Stay calm and call batman!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyone?
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you know if the twitter.h library is still valid?

I recall Twitter made a lot of changes to their API recently that may have broken it.
Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Stay calm and call batman!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi yes I is, I used it recently
Logged

Pages: [1]   Go Up
Jump to: