Skip to content

Commit 3c03e7a

Browse files
author
Pete Lewis
committed
Switched from logical not operator "!" to comparison to false "==" in setups.
This is slightly easier to teach when introducing young coders to our example sketches. We prefer to keep the logical not operator "!" for later lessons (if possible).
1 parent 97cc721 commit 3c03e7a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

examples/LSM9DS1_Basic_I2C/LSM9DS1_Basic_I2C.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void setup()
9696

9797
Wire.begin();
9898

99-
if (!imu.begin()) // with no arguments, this uses default addresses (AG:0x6B, M:0x1E) and i2c port (Wire).
99+
if (imu.begin() == false) // with no arguments, this uses default addresses (AG:0x6B, M:0x1E) and i2c port (Wire).
100100
{
101101
Serial.println("Failed to communicate with LSM9DS1.");
102102
Serial.println("Double-check wiring.");

examples/LSM9DS1_Basic_SPI/LSM9DS1_Basic_SPI.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void setup()
9999

100100
// imu.beginSPI(), which verifies communication with the IMU
101101
// and turns it on.
102-
if (!imu.beginSPI(LSM9DS1_AG_CS, LSM9DS1_M_CS)) // note, we need to sent this our CS pins (defined above)
102+
if (imu.beginSPI(LSM9DS1_AG_CS, LSM9DS1_M_CS) == false) // note, we need to sent this our CS pins (defined above)
103103
{
104104
Serial.println("Failed to communicate with LSM9DS1.");
105105
Serial.println("Double-check wiring.");

examples/LSM9DS1_Interrupts/LSM9DS1_Interrupts.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void setup()
196196
// check the return status of imu.begin() to make sure
197197
// it's connected.
198198
uint16_t status = configureIMU();
199-
if (!status)
199+
if (status == false)
200200
{
201201
Serial.print("Failed to connect to IMU: 0x");
202202
Serial.println(status, HEX);

0 commit comments

Comments
 (0)