start:arduino:emg:diy
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
start:arduino:emg:diy [2023/02/14 12:20] – [Optionnel] gerardadmin | start:arduino:emg:diy [2023/02/14 12:27] (Version actuelle) – [Fichier GitHub] gerardadmin | ||
---|---|---|---|
Ligne 121: | Ligne 121: | ||
[[https:// | [[https:// | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | |||
+ | ===== Code Exemple ===== | ||
+ | |||
+ | <code c exemple_EMG_Arduino.ino> | ||
+ | // reads analog input from the five inputs from your arduino board | ||
+ | // and sends it out via serial | ||
+ | |||
+ | // variables for input pins and | ||
+ | int analogInput[6]; | ||
+ | | ||
+ | // variable to store the value | ||
+ | int value[6]; | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | // declaration of pin modes | ||
+ | for(int i=0; | ||
+ | { | ||
+ | analogInput[i] = i+1; | ||
+ | value[i] = 0; | ||
+ | pinMode(analogInput[i], | ||
+ | } | ||
+ | | ||
+ | // begin sending over serial port | ||
+ | Serial.begin(9600); | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | // read the value on analog input | ||
+ | for(int i=0; | ||
+ | { | ||
+ | value[i] = analogRead(analogInput[i]); | ||
+ | } | ||
+ | |||
+ | // print out value over the serial port | ||
+ | for(int i=0; | ||
+ | { | ||
+ | Serial.println(10000 + i + 1); //prefix | ||
+ | Serial.println(value[i]); | ||
+ | Serial.println(10010); | ||
+ | } | ||
+ | // wait for a bit to not overload the port | ||
+ | delay(10); | ||
+ | } | ||
+ | |||
+ | |||
+ | </ |
/home/chanteri/www/fablab37110/data/attic/start/arduino/emg/diy.1676373649.txt.gz · Dernière modification : de gerardadmin