Skip to content

Commit 8052c97

Browse files
committed
AddressChanger: add sanity check for new address
1 parent ee39818 commit 8052c97

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/AddressChanger/AddressChanger.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ void setup() {
99
Wire1.begin();
1010
Serial.begin(115200);
1111
delay(1000);
12+
if (new_address != 0 && (new_address < 8 || new_address > 0x77)) {
13+
Serial.println("Address outside valid range");
14+
while (1);
15+
}
1216
// Search for devices and wait for user confirmation
1317
for (int i = 8; i < 128; i++) {
1418
Wire1.beginTransmission(i);

0 commit comments

Comments
 (0)