99from lcdI2C import LCD_I2C
1010
1111# If you aren't using the Qwiic connector, manually enter your I2C pins
12- #i2c = I2C(0, scl=Pin(22), sda=Pin(21))
13- #lcd = LCD_I2C(i2c)
12+ # i2c = I2C(0, scl=Pin(22), sda=Pin(21))
13+ # lcd = LCD_I2C(i2c)
1414
1515# Initialize sensor over Qwiic
1616lcd = LCD_I2C ()
1717
18- #Turn on the backlight of the LCD
18+ # Turn on the backlight of the LCD
1919lcd .backlight ()
2020
21- #Start communication with the LCD over I2C
21+ # Start communication with the LCD over I2C
2222lcd .begin ()
2323
2424# Hello world example
25- #Sets the cursor to the first character place in the first row
25+ # Sets the cursor to the first character place in the first row
2626lcd .setCursor (0 , 0 )
2727lcd .print ("Hello, World!" )
28- #Sets the cursor to the first character place in the second row
28+ # Sets the cursor to the first character place in the second row
2929lcd .setCursor (0 , 1 )
3030lcd .print ("Made by Soldered!" )
3131
3232time .sleep (5.0 )
3333
3434# Custom character example, Characters are in binary form, each row represents a row of pixels and a 1 represents that a pixel is turned on
35- #A smiley face :)
35+ # A smiley face :)
3636happy = [
3737 0b00000 ,
3838 0b10001 ,
4444 0b00000 ,
4545]
4646
47- #A shocked face :o
47+ # A shocked face :o
4848wow = [
4949 0b00000 ,
5050 0b10001 ,
5656 0b00000 ,
5757]
5858
59- #An anchor
60- anchor = [
61- 0b01110 ,
62- 0b01010 ,
63- 0b01110 ,
64- 0b00100 ,
65- 0b10101 ,
66- 0b10101 ,
67- 0b01110 ,
68- 0b00100
69- ]
59+ # An anchor
60+ anchor = [0b01110 , 0b01010 , 0b01110 , 0b00100 , 0b10101 , 0b10101 , 0b01110 , 0b00100 ]
7061
71- #A snowflake
72- snow = [
73- 0b01000 ,
74- 0b11101 ,
75- 0b01011 ,
76- 0b00001 ,
77- 0b00100 ,
78- 0b01110 ,
79- 0b00100 ,
80- 0b10000
81- ]
62+ # A snowflake
63+ snow = [0b01000 , 0b11101 , 0b01011 , 0b00001 , 0b00100 , 0b01110 , 0b00100 , 0b10000 ]
8264
83- #Write the defined c haracters into memory
65+ # Write the defined c haracters into memory
8466lcd .createChar (0 , happy )
8567lcd .createChar (1 , wow )
8668lcd .createChar (2 , anchor )
8769lcd .createChar (3 , snow )
8870
89- #Clear the screen
71+ # Clear the screen
9072lcd .clear ()
9173
9274lcd .setCursor (0 , 0 )
10082# Autoscroll example
10183
10284lcd .clear ()
103- sentence = "Autoscroll example"
104- #When autoscroll is enabled, the characters will scroll to the left to make room for oncoming characters
85+ sentence = "Autoscroll example"
86+ # When autoscroll is enabled, the characters will scroll to the left to make room for oncoming characters
10587lcd .autoscroll ()
106- #Set cursor to the last place in row
107- lcd .setCursor (16 ,0 )
108- #Go through each character in sentence and print one every second
109- for i in range (len (sentence )):
110- #Display the character onto the screen
88+ # Set cursor to the last place in row
89+ lcd .setCursor (16 , 0 )
90+ # Go through each character in sentence and print one every second
91+ for i in range (len (sentence )):
92+ # Display the character onto the screen
11193 lcd .print (sentence [i ])
112- time .sleep (1.0 )
94+ time .sleep (1.0 )
0 commit comments