Skip to content

Commit 1b401bf

Browse files
committed
Made code.py work when heart rate sensor isn't connected
1 parent 03863eb commit 1b401bf

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

CircuitPython_Pyloton/code.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@
5454
# Comment out the following line and uncomment the previous line if you aren't using a
5555
# heart rate monitor
5656
if hr_connection and hr_connection.connected and speed_cad_connections:
57-
print("Fetch connection")
58-
hr_service = hr_connection[HeartRateService]
59-
#hr_service = None
60-
print("Location:", hr_service.location)
57+
if heart:
58+
print("Fetch connection")
59+
hr_service = hr_connection[HeartRateService]
60+
print("Location:", hr_service.location)
6161
pyloton.setup_display()
6262
break
6363

64+
# Replace following line with while True if you aren't using a heart rate sensor
6465
while hr_connection.connected:
6566
pyloton.update_display()
6667
pyloton.ams_remote()

0 commit comments

Comments
 (0)