Add sanity check

This commit is contained in:
Kenwood 2021-07-04 20:36:13 -04:00
parent 13eb27b9c3
commit 32bd0f5b55
1 changed files with 9 additions and 7 deletions

View File

@ -33,12 +33,14 @@ void loop() {
// This method runs when we receive a message // This method runs when we receive a message
void receiveEvent(int n) { void receiveEvent(int n) {
id = Wire.read(); // ID of the servo/device to access if (Wire.available() == 2) { // Dont do anything if this is not true
val = Wire.read(); // Value to assign id = Wire.read(); // ID of the servo/device to access
val = Wire.read(); // Value to assign
switch(id) { switch(id) {
case 1: case 1:
windowWiperServo.write(val); windowWiperServo.write(val);
break; break;
}
} }
} }