#define LEDH 9
#define LEDB 11
#define LEDG 12
#define LEDD 8
#define LEDC 10
int STICH = A0;
int STICV = A1;
#define STICC 2
int valH ;
int valV ;
float VALH ;
float VALV ;
void setup() {
Serial.begin(9600);
pinMode(STICC, INPUT_PULLUP);
}
void loop() {
valH = analogRead(STICH);
VALH = map(valH, 0, 1023, -128, 128);
Serial.println(VALH);
valV= analogRead(STICV);
VALV = map(valV, 0, 1023, -128, 128);
Serial.print(VALV);
if(VALV > 0){
digitalWrite(LEDH, HIGH);
}
else{
digitalWrite(LEDH, LOW);
}
if(VALV < 0){
digitalWrite(LEDB, HIGH);
}
else{
digitalWrite(LEDB, LOW);
}
if(VALH > 0){
digitalWrite(LEDG, HIGH);
}
else{
digitalWrite(LEDG, LOW);
}
if(VALH < 0){
digitalWrite(LEDD, HIGH);
}
else{
digitalWrite(LEDD, LOW);
}
bool etatbouton = digitalRead(STICC);
if(etatbouton)
{
digitalWrite(LEDC, LOW);
Serial.print("bouton off");
}
else //(etatbouton == false);
{
digitalWrite(LEDC, HIGH);
Serial.print("bouton on");
}
}