Go Down

Topic: Ethernet to wifi help (Read 364 times) previous topic - next topic

chucky23

Code: [Select]
#if defined(ARDUINO) && ARDUINO > 18   // Arduino 0019 or later
#include <SPI.h>
#endif
#include <Ethernet.h>
//#include <EthernetDNS.h>  Only needed in Arduino 0022 or earlier
#include <Twitter.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
Twitter twitter("<<< your token here >>>");
char msg[] = "Hello, World! I'm Arduino!";

void setup()
{
  delay(1000);
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
 
  Serial.println("connecting ...");
  if (twitter.post(msg)) {
    int status = twitter.wait();
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }
}

void loop()
{
}


I wanted to use wifi shield rather than Ethernet shield. this works using Ethernet shield but i need help in transforming this code to be used in wifi shield.
any help would be greatly appreciated.

pitusso

Hi,
you can look at here:
https://github.com/OfficineArduino/arduinotour/blob/master/examples/postTweet/postTweet.ino

chucky23

thanks for the help, but i tried and it states that "error compiling"
how can i correct that?

PaulS

Quote
how can i correct that?

Remove the problems.

chucky23

thanks alot, I've removed the problems now

Go Up