4343import time
4444import sys
4545
46- def runExample ():
46+ def run_example ():
4747
4848 print ("\n SparkFun Qwiic Button Example 4" )
49- myButton = qwiic_button .QwiicButton ()
49+ my_button = qwiic_button .Qwiic_Button ()
5050
51- if myButton .begin () == False :
51+ if my_button .begin () == False :
5252 print ("\n The Qwiic Button isn't connected to the system. Please check your connection" , \
5353 file = sys .stderr )
5454 return
@@ -58,28 +58,28 @@ def runExample():
5858 while True :
5959
6060 # If the queue of pressed events is not empty
61- if myButton . isPressedQueueEmpty () == False :
61+ if my_button . is_pressed_queue_empty () == False :
6262 # Then print the time since the last and first button press
63- print ("\n " + str (myButton . timeSinceLastPress () / 1000.0 ) + "s since he button was last pressed " )
64- print (str (myButton . timeSinceFirstPress () / 1000.0 ) + "s since the button was first pressed " )
63+ print ("\n " + str (my_button . time_since_last_press () / 1000.0 ) + "s since he button was last pressed " )
64+ print (str (my_button . time_since_first_press () / 1000.0 ) + "s since the button was first pressed " )
6565 # If the queue is empty
6666 else :
67- print ("\n ButtonPressed Queue is empty! " )
67+ print ("\n Button Pressed Queue is empty! " )
6868
6969 # If the queue of clicked events is not empty
70- if myButton . isClickedQueueEmpty () == False :
70+ if my_button . is_clicked_queue_empty () == False :
7171 # Then print the time since the last and first button click
72- print ("\n " + str (myButton . timeSinceLastClick () / 1000.0 ) + "s since the button was last clicked " )
73- print (str (myButton . timeSinceFirstClick () / 1000.0 ) + "s since the button was first clicked" )
72+ print ("\n " + str (my_button . time_since_last_click () / 1000.0 ) + "s since the button was last clicked " )
73+ print (str (my_button . time_since_first_click () / 1000.0 ) + "s since the button was first clicked" )
7474 # If the queue is empty
7575 else :
76- print ("\n ButtonClicked Queue is empty!" )
76+ print ("\n Button Clicked Queue is empty!" )
7777
7878 time .sleep (0.02 ) # Let's not hammer too hard on the I2C bus
7979
8080if __name__ == '__main__' :
8181 try :
82- runExample ()
82+ run_example ()
8383 except (KeyboardInterrupt , SystemExit ) as exErr :
8484 print ("\n Ending Example 4" )
8585 sys .exit (0 )
0 commit comments