File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- """
2- Read heart rate data from a heart rate peripheral using the standard BLE
3- Heart Rate service.
4- """
5-
61from time import time
72import adafruit_ble
83import board
2621
2722pyloton .show_splash ()
2823
29- pyloton .ams_connect ()
24+ ams = pyloton .ams_connect ()
3025
3126
3227start = time ()
5045 # Stop scanning whether or not we are connected.
5146 ble .stop_scan ()
5247
53- #if speed_cad_connections:
54- # Comment out the following line and uncomment the previous line if you aren't using a
55- # heart rate monitor
56- if hr_connection and hr_connection .connected and speed_cad_connections :
48+ # You may need to remove some parts of the following line depending on what
49+ # devices you are using.
50+ print (type (hr_connection ))
51+ print (type (speed_cad_connections ))
52+ print (type (ams ))
53+ if hr_connection and hr_connection .connected and speed_cad_connections [0 ] and speed_cad_connections [0 ].connected and ams and ams .connected :
5754 if heart :
5855 print ("Fetch connection" )
5956 hr_service = hr_connection [HeartRateService ]
6057 print ("Location:" , hr_service .location )
6158 pyloton .setup_display ()
6259 break
6360
64- # Replace following line with while True if you aren't using a heart rate sensor
65- while hr_connection .connected :
61+ # You may need to remove some parts of the following line depending on what devices you are using.
62+ while hr_connection .connected and speed_cad_connections [ 0 ]. connected and ams . connected :
6663 pyloton .update_display ()
6764 pyloton .ams_remote ()
65+
66+ print ("\n \n Not all sensors are connected. Please reset to try again\n \n " )
You can’t perform that action at this time.
0 commit comments