Bonjour,
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
buttonState = digitalRead(buttonPin2); // La valeur précédente a été écrasé ici
// check if the pushbutton is pressed.
if (buttonState == HIGH)(buttonPin); { // Ce if n'as pas de sens
IPAddress remoteIP(192, 168, 1, 26); // ip du serveur
Udp.beginPacket(remoteIP, 9999);
Udp.write("label: debut");
Udp.endPacket();
delay(10000);
}
if (buttonState == HIGH)(buttonPin2); {
IPAddress remoteIP(192, 168, 1, 26); // ip du serveur
Udp.beginPacket(remoteIP, 9999);
Udp.write("label: fin");
Udp.endPacket();
delay(10000);
if (buttonState == LOW)
client.stop();
}
Aucune chance que ça marche ! ![]()
(ça va compiler car au niveau purement syntaxique il n'y as pas d'erreur, mais pas marcher du tout car sémantiquement c'est totalement faux)
// read the state of the pushbutton value:
byte buttonState1 = digitalRead(buttonPin);
bytebuttonState2 = digitalRead(buttonPin2);
// check if the pushbutton is pressed.
if (buttonState1 == HIGH) {
IPAddress remoteIP(192, 168, 1, 26); // ip du serveur
Udp.beginPacket(remoteIP, 9999);
Udp.write("label: debut");
Udp.endPacket();
delay(10000);
}
if (buttonState2 == HIGH) {
IPAddress remoteIP(192, 168, 1, 26); // ip du serveur
Udp.beginPacket(remoteIP, 9999);
Udp.write("label: fin");
Udp.endPacket();
delay(10000);
}
if (buttonState1 == LOW || buttonState2 == LOW)
client.stop();
}