#include //—– Adressage matériel —– // En cas de non fonctionnement, mettez la ligne 8 en // commentaire et retirez le commentaire à la ligne 9. LiquidCrystal_I2C lcd(0x27, 20, 4); int VRx = A0; int VRy = A1; int SW = 2; int xPosition = 0; int yPosition = 0; int SW_state = 0; int mapX = 0; int mapY = 0; void setup() { lcd.init(); // initialisation de l’afficheur pinMode(VRx, INPUT); pinMode(VRy, INPUT); pinMode(SW, INPUT_PULLUP); } void loop() { lcd.backlight(); lcd.clear(); // effacer le contenu de l’Afficheur LCD xPosition = analogRead(VRx); yPosition = analogRead(VRy); SW_state = digitalRead(SW); mapX = map(xPosition, 0, 1023, -512, 512); mapY = map(yPosition, 0, 1023, -512, 512); if ((mapX>=-515)&& (mapX<=-510)&&(mapY>=-175)&& (mapY<=-168)) lcd.print("Avant"); if ((mapX>=168)&& (mapX<=175)&&(mapY>=-175)&& (mapY<=-168)) lcd.print("Arriere"); if ((mapX<=-166)&& (mapX>=-175)&&(mapY>=-515)&& (mapY<=-510)) lcd.print("Droite"); if ((mapX>=-175)&& (mapX<=-170)&&(mapY>=165)&& (mapY<=175)) lcd.print("Gauche"); if (SW_state==0) lcd.print("Bouton appuye"); delay(1000); }