Você está na página 1de 12

Baptiste Gaultier

BY-SA 2.0 Baptiste Gaultier

Introduction
Arduino Ethernet Micro-contrleur Mmoire Port Ethernet Carte SD Entres/sorties

Introduction
Internet? 2,4 milliards d'utilisateurs relis entre eux
Asie (44%) Europe (21%) Amrique du nord (13%) Amrique latine (10%) Afrique (7%) Autres (5%)

Une augmentation de 566% entre 2000 et

2012

Introduction
Internet?

Introduction
Internet?

twitter.com?

199.59.148.10 2a00:1450:4007:801::101f

Programme de l'atelier
Arduino qui rcupre les infos Twitter

Installation de l'IDE

Installation des pilotes (Windows, Mac) Ouverture de l'exemple TwitterClient:

FichierExemplesEthernetTwitterClient
Modifications du croquis Ajout du servo moteur

Modification du croquis
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x01 }; IPAddress ip(192,168,1,20); // initialize the library instance: EthernetClient client; const unsigned long requestInterval = 60000; char serverName[] = "api.twitter.com"; // delay between requests

// twitter URL

Modification du croquis
// attempt a DHCP connection: Serial.println("Attempting to get an IP address using DHCP:"); if (!Ethernet.begin(mac)) { // if DHCP fails, start with a hard-coded address: Serial.println("failed to get an IP address using DHCP, trying manually"); Ethernet.begin(mac, ip); } Serial.print("My address:"); Serial.println(Ethernet.localIP()); // connect to Twitter: connectToServer();

Modification du croquis
void connectToServer() { // attempt to connect, and wait a millisecond: Serial.println("connecting to server..."); if (client.connect(serverName, 80)) { Serial.println("making HTTP request..."); // make HTTP GET request to twitter: client.println("GET /1/statuses/user_timeline.xml?screen_name=arduino&count=1 HTTP/1.1"); client.println("HOST: api.twitter.com"); client.println(); }

Modification du croquis
if ( currentLine.endsWith("<text>")) { // tweet is beginning. Clear the tweet string: readingTweet = true; tweet = ""; } if (readingTweet) { if (inChar != '<') { tweet += inChar; } else { // if you got a "<" character, // you've reached the end of the tweet: readingTweet = false; Serial.println(tweet);

Programme de l'atelier

Ajouter la fonctionnalit Servo Moteur en vous basant sur l'exemple Sweep: FichierExemplesServoSweep

Você também pode gostar