Add sanity check
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
@@ -42,3 +43,4 @@ void receiveEvent(int n) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user