diff options
author | NeodarZ <bretoncorentin44@gmail.com> | 2015-03-05 17:58:18 +0100 |
---|---|---|
committer | NeodarZ <bretoncorentin44@gmail.com> | 2015-03-05 17:58:18 +0100 |
commit | 684098dccd33bba766833e7ce0de943eb399174f (patch) | |
tree | bbb6361676f00d8f6cedebd8c2fad1aefdb546c8 /Code_Arduino_Telecommande/Code_Arduino_Telecommande.ino | |
parent | 0c108cab25098c2a92d9a936feeb7a11708ed6c8 (diff) | |
download | Robot-Cable-684098dccd33bba766833e7ce0de943eb399174f.tar.xz Robot-Cable-684098dccd33bba766833e7ce0de943eb399174f.zip |
Ajout du code Arduino de la télécommande et Processing du menu
Diffstat (limited to '')
-rw-r--r-- | Code_Arduino_Telecommande/Code_Arduino_Telecommande.ino | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/Code_Arduino_Telecommande/Code_Arduino_Telecommande.ino b/Code_Arduino_Telecommande/Code_Arduino_Telecommande.ino new file mode 100644 index 0000000..908e08e --- /dev/null +++ b/Code_Arduino_Telecommande/Code_Arduino_Telecommande.ino @@ -0,0 +1,120 @@ +int LED_ROUGE = 2; +int LED_ORANGE = 3; +int LED_VERTE = 4; +int BOUTON_GAUCHE = 8; +int BOUTON_DROITE = 11; +int BOUTON_BAS = 10; +int BOUTON_HAUT = 9; +int BOUTON_VAL = 12; + +int ETAT_BOUTON_GAUCHE; +int ETAT_BOUTON_DROITE; +int ETAT_BOUTON_HAUT; +int ETAT_BOUTON_BAS; +int ETAT_BOUTON_VAL; + +void setup() +{ + Serial.begin(9600); + pinMode(LED_ROUGE, OUTPUT); + pinMode(LED_VERTE, OUTPUT); + pinMode(LED_ORANGE, OUTPUT); + pinMode(BOUTON_GAUCHE, INPUT); + pinMode(BOUTON_DROITE, INPUT); + pinMode(BOUTON_BAS, INPUT); + pinMode(BOUTON_HAUT, INPUT); + pinMode(BOUTON_VAL, INPUT); +} + +void loop() +{ + ETAT_BOUTON_GAUCHE = digitalRead(BOUTON_GAUCHE); + if (ETAT_BOUTON_GAUCHE == 0) + { + digitalWrite(LED_VERTE, 1); + Serial.print("BTG"); + Serial.print(1); + Serial.print(";"); + delay(500); + } + else + { + digitalWrite(LED_VERTE, 0); + Serial.print("BTG"); + Serial.print(0); + Serial.print(";"); + } + + + ETAT_BOUTON_DROITE = digitalRead(BOUTON_DROITE); + if (ETAT_BOUTON_DROITE == 0) + { + digitalWrite(LED_ORANGE, 1); + Serial.print("BTD"); + Serial.print(1); + Serial.print(";"); + delay(500); + } + else + { + digitalWrite(LED_ORANGE, 0); + Serial.print("BTD"); + Serial.print(0); + Serial.print(";"); + } + + + ETAT_BOUTON_BAS = digitalRead(BOUTON_BAS); + if (ETAT_BOUTON_BAS == 0) + { + digitalWrite(LED_ROUGE, 1); + Serial.print("BTB"); + Serial.print(1); + Serial.print(";"); + delay(500); + } + else + { + digitalWrite(LED_ROUGE, 0); + Serial.print("BTB"); + Serial.print(0); + Serial.print(";"); + } + + + ETAT_BOUTON_HAUT = digitalRead(BOUTON_HAUT); + if (ETAT_BOUTON_HAUT == 0) + { + digitalWrite(LED_ROUGE, 1); + Serial.print("BTH"); + Serial.print(1); + Serial.print(";"); + delay(500); + } + else + { + digitalWrite(LED_ROUGE, 0); + Serial.print("BTH"); + Serial.print(0); + Serial.print(";"); + } + + + ETAT_BOUTON_VAL = digitalRead(BOUTON_VAL); + if (ETAT_BOUTON_VAL == 0) + { + digitalWrite(LED_ROUGE, 1); + Serial.print("BTV"); + Serial.print(1); + Serial.println(";"); + delay(500); + } + else + { + digitalWrite(LED_ROUGE, 0); + Serial.print("BTV"); + Serial.print(0); + Serial.println(";"); + } +} + |