Ligne 306 : |
Ligne 306 : |
| Tapez 'H' pour allumer la LED sur la broche 13 et 'L' pour l'éteindre. | | Tapez 'H' pour allumer la LED sur la broche 13 et 'L' pour l'éteindre. |
| | | |
− | == Process == | + | == Les commandes Process == |
− | The Process commands allow you to run Linux processes on Linino through the Arduino.
| + | Les commandes ''Process'' permettent d'exécuter des processus Linux sur Linino par l'intermédiaire d'Arduino. |
| | | |
− | In the following example, The Linino will connect to a server with curl, and download some ASCII text. It prints the text a serial connection.
| + | Dans l'exemple uivant, Linino va se connecter sur un serveur en utilisant [http://fr.wikipedia.org/wiki/CURL curl] et de télécharger du texte ASCII. Il affiche ensuite le texte sur la connexion série. |
| <nowiki>#include <Process.h> | | <nowiki>#include <Process.h> |
| | | |
| void setup() { | | void setup() { |
− | // Initialize Bridge | + | // Initialisation du Bridge |
| Bridge.begin(); | | Bridge.begin(); |
| | | |
− | // Initialize Serial | + | // Initialisation du port série |
| Serial.begin(9600); | | Serial.begin(9600); |
| | | |
− | // Wait until a Serial Monitor is connected. | + | // Attendre qu'un moniteur série soit connecté. |
| while (!Serial); | | while (!Serial); |
| | | |
− | // run various example processes | + | // Executer les différents processus d'exemple |
| runCurl(); | | runCurl(); |
| } | | } |
| | | |
| void loop() { | | void loop() { |
− | // Do nothing here. | + | // Rien à faire. |
| } | | } |
| | | |
| void runCurl() { | | void runCurl() { |
− | // Launch "curl" command and get Arduino ascii art logo from the network | + | // Execute la commande "curl" et obtenir un logo Arduino en "ascii art" depuis le Net |
− | // curl is command line program for transferring data using different internet protocols | + | // curl est un programme en ligne de commande pour transférer des données en utilisant |
− | Process p; // Create a process and call it "p" | + | // différents protocols Internet |
− | p.begin("curl"); // Process that launch the "curl" command | + | Process p; // Créer un processus et appellons le "p" |
− | p.addParameter("http://arduino.cc/asciilogo.txt"); // Add the URL parameter to "curl" | + | p.begin("curl"); // Processus qui démarre la commande "curl" |
− | p.run(); // Run the process and wait for its termination | + | p.addParameter("http://arduino.cc/asciilogo.txt"); // Ajouter le parametre URL à "curl" |
| + | p.run(); // Exécuter le processus et attendre sa fin d'exécution |
| | | |
− | // Print arduino logo over the Serial | + | // Afficher le logo Arduino sur le port série |
− | // A process output can be read with the stream methods | + | // La sortie d'un processus (''process output'') peut être lut à laide |
| + | // des méthodes de streaming (gestion de flux) |
| while (p.available()>0) { | | while (p.available()>0) { |
| char c = p.read(); | | char c = p.read(); |
| Serial.print(c); | | Serial.print(c); |
| } | | } |
− | // Ensure the last bit of data is sent. | + | // S'assurer que les derniers bits de données soit bien envoyés |
| Serial.flush(); | | Serial.flush(); |
| }</nowiki> | | }</nowiki> |