Skip to content

Commit 8f53629

Browse files
committed
Fix sensor begin in examples
Fix usage of is_connected() in Example 1 Update Example 2 to begin the sensor in the same way as Example 1
1 parent 1d6a816 commit 8f53629

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

examples/Example1-GetReadings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def runExample():
4949
print("\nSparkFun Qwiic Soil Moisture Sensor Example 1\n")
5050
mySoilSensor = qwiic_soil_moisture_sensor.QwiicSoilMoistureSensor()
5151

52-
if mySoilSensor.is_connected == False:
52+
if mySoilSensor.is_connected() == False:
5353
print("The Qwiic Soil Moisture Sensor device isn't connected to the system. Please check your connection", \
5454
file=sys.stderr)
5555
return

examples/Example2-Change_I2C_Address.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ def runExample():
4949
print("\nSparkFun Qwiic Soil Moisture Sensor Example 2 - Change I2C Address\n")
5050
mySoilSensor = qwiic_soil_moisture_sensor.QwiicSoilMoistureSensor()
5151

52-
status = mySoilSensor.begin()
53-
if status == False:
54-
print ("\nStatus: ", status)
52+
if mySoilSensor.is_connected() == False:
53+
print("The Qwiic Soil Moisture Sensor device isn't connected to the system. Please check your connection", \
54+
file=sys.stderr)
55+
return
56+
57+
mySoilSensor.begin()
5558

5659
print("\nReady!")
5760
print("\nEnter a new I2C address for the Qwiic Soil Moisture Sensor to use.")

0 commit comments

Comments
 (0)