Add sanity check
This commit is contained in:
parent
13eb27b9c3
commit
32bd0f5b55
|
@ -33,6 +33,7 @@ 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) {
|
||||||
|
if (Wire.available() == 2) { // Dont do anything if this is not true
|
||||||
id = Wire.read(); // ID of the servo/device to access
|
id = Wire.read(); // ID of the servo/device to access
|
||||||
val = Wire.read(); // Value to assign
|
val = Wire.read(); // Value to assign
|
||||||
|
|
||||||
|
@ -41,4 +42,5 @@ void receiveEvent(int n) {
|
||||||
windowWiperServo.write(val);
|
windowWiperServo.write(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue