11# !/usr/bin/env python
22# ----------------------------------------------------------------------
3- # qwiic_alphanumeric_ex5_set_brightness .py
3+ # qwiic_alphanumeric_ex4_set_brightness .py
44#
55# This example sets the brightness of the Qwiic Alphanumeric display.
66# ----------------------------------------------------------------------
3737# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3838# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3939#=======================================================================
40- # Example 5
40+ # Example 4
4141
4242from __future__ import print_function
4343import qwiic_alphanumeric
4646
4747def run_example ():
4848
49- print ("\n SparkFun Qwiic Alphanumeric - Example 5 : Set Brightness" )
49+ print ("\n SparkFun Qwiic Alphanumeric - Example 4 : Set Brightness" )
5050 my_display = qwiic_alphanumeric .QwiicAlphanumeric ()
5151
5252 if my_display .begin () == False :
@@ -56,18 +56,21 @@ def run_example():
5656
5757 print ("\n Qwiic Alphanumeric Ready!" )
5858
59- while True :
59+ my_display .print ("Milk" )
60+
61+ # Repeat a few times
62+ for i in range (4 ):
63+ # Loop through all brightness settings
6064 for i in range (0 , 16 ):
6165 # The input to set_brightness() is a duty cycle over 16
62- # So, the acceptable inputs to this function are ints between 0 (display off)
63- # and 15 (full brightness)
66+ # So, the acceptable inputs to this function are ints between 0
67+ # (1/16 brightness) and 15 (full brightness)
6468 my_display .set_brightness (i )
65- my_display .display_print ("Milk" )
66- time .sleep (1 )
69+ time .sleep (0.1 )
6770
6871if __name__ == '__main__' :
6972 try :
7073 run_example ()
7174 except (KeyboardInterrupt , SystemExit ) as exErr :
72- print ("\n Ending Example 5 " )
75+ print ("\n Ending Example 4 " )
7376 sys .exit (0 )
0 commit comments