#include // YUN ARDUINO Qualif des temps de réponse, wifi intégré. // 25 12 2014 N'utilise pas la technologie 'REST'. // Console.h permet d'échanger en Wifi MAIS PAS D'INITIALISER l'échange ARDUINO-SERVER! // ainsi il faut valider le mode 'console' avec Ctrl+ Maj+ M //#define delaisAttente // ajoute délais attente entre 2 réceptions de bytes const int ledPin = 13; // the pin that the LED is attached to int incomingByte; // a variable to read incoming serial data into void setup() { // initialize serial communication: Bridge.begin(); Console.begin(); while (!Console){ ; // wait for Console port to connect. } Console.println("YUN> You're connected to the Console!!!!"); Console.println("\nPermet d'echanger en Wifi MAIS PAS D'INITIALISER l'echange ARDUINO-SERVER!!"); Console.println("\n (manquent instructions server.begin() .... etc )"); Console.println("\ncapital H (ASCII 72), turn on the LED"); Console.println("capital L (ASCII 76) turn off the LED"); Console.println("chainage de commandes possible! sur LED13"); Console.println("ex: 'HLHL H LHL HLHLHL' alternat ON/OFF de la LED13"); // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); } void loop() { // see if there's incoming serial data: if (Console.available() > 0) { // read the oldest byte in the serial buffer: incomingByte = Console.read(); // if it's a capital H (ASCII 72), turn on the LED: if (incomingByte == 'H') { digitalWrite(ledPin, HIGH); } // if it's an L (ASCII 76) turn off the LED: if (incomingByte == 'L') { digitalWrite(ledPin, LOW); } } #ifdef delaisAttente delay(20); //delay(100); #endif }