Go Down

Topic: arduino twitter Help (Read 319 times) previous topic - next topic

DMond

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: [Select]

#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!!

DMond


oxxo

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.

DMond

Hi yes I is, I used it recently

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy