File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
examples/Example3_ChangeAddress Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ uint8_t deviceAddress = kQwiicUltrasonicDefaultAddress; // 0x2F
2828
2929// New addres is 7-bit unshifted.
3030uint8_t NEW_ADDR = 0x1E ;
31+ // If using an older version of the Qwiic Ultrasonic, your address range is: 0x20 - 0x2F
32+ // uint8_t NEW_ADDR = 0x2F;
33+
3134
3235void setup ()
3336{
@@ -54,9 +57,24 @@ void setup()
5457 Serial.print (" Changing Address To: " );
5558 Serial.println (NEW_ADDR, HEX);
5659
60+
5761 // Call change address.....
58- myUltrasonic.changeAddress (NEW_ADDR);
62+ sfeTkError_t err = myUltrasonic.updateAddress (NEW_ADDR);
63+ // If you have an older version of the Qwiic Ultrasonic, you'll need to use the following:
64+ // sfeTkError_t err = myUltrasonic.changeAddress(NEW_ADDR);
65+
66+ if (err)
67+ {
68+ while (1 )
69+ {
70+ Serial.print (" Error changing address: " );
71+ Serial.println (err);
72+ delay (1000 );
73+ }
74+ }
5975 delay (1000 );
76+
77+ // I
6078
6179
6280 Serial.print (" Load up example 1 with the new address at: " );
You can’t perform that action at this time.
0 commit comments