Top Banner

of 12

Atelier arduino avancé, par Baptiste Gaultier

Apr 04, 2018

Download

Documents

labfabfr
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    1/12

    Baptiste Gaultier

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    2/12

    BY-SA 2.0 Baptiste Gaultier

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    3/12

    Introduction

    Arduino Ethernet

    Micro-contrleur

    Mmoire

    Port Ethernet

    Carte SD

    Entres/sorties

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    4/12

    Introduction

    Internet ?

    2,4 milliards d'utilisateurs relis entre eux

    Une augmentation de 566 % entre 2000 et2012

    Asie (44%)

    Europe (21%)

    Amrique du nord (13%)

    Amrique latine (10%)

    Afrique (7%)

    Autres (5%)

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    5/12

    Introduction

    Internet ?

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    6/12

    Introduction

    Internet ?

    twitter.com ? 199.59.148.10

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

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    7/12

    Programme de l'atelier

    Arduino qui rcupre les infos Twitter

    Installation de l'IDE

    Installation des pilotes (Windows, Mac)

    Ouverture de l'exemple TwitterClient :

    Fichier Exemples Ethernet TwitterClient

    Modifications du croquis

    Ajout du servo moteur

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    8/12

    Modification du croquis

    byte mac[] = {

    0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x01 };

    IPAddress ip(192,168,1,20);

    // initialize the library instance:

    EthernetClient client;

    const unsignedlong requestInterval = 60000; // delay between requests

    char serverName[] = "api.twitter.com"; // twitter URL

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    9/12

    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();

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    10/12

    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();

    }

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    11/12

    Modification du croquis

    if ( currentLine.endsWith("")) {

    // tweet is beginning. Clear the tweet string:

    readingTweet = true;

    tweet = "";

    }

    if (readingTweet) {

    if (inChar != '

  • 7/30/2019 Atelier arduino avanc, par Baptiste Gaultier

    12/12

    Programme de l'atelier

    Ajouter la fonctionnalit Servo Moteur en vous basantsur l'exemple Sweep :Fichier Exemples Servo Sweep