Skip to content

Commit 33e3306

Browse files
committed
Forgot to do examples
1 parent d034b52 commit 33e3306

File tree

7 files changed

+55
-45
lines changed

7 files changed

+55
-45
lines changed

adafruit_character_lcd/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""include all classes"""
2-
from adafruit_character_lcd.character_lcd import Character_LCD_I2C, Character_LCD_SPI
2+
from adafruit_character_lcd.character_lcd import Character_LCD, Character_LCD_I2C, Character_LCD_SPI
33
from adafruit_character_lcd.character_lcd_rgb import Character_LCD_RGB

examples/custom_character_nyan_cat.py

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import time, digitalio
1+
import time
2+
import digitalio
23
import adafruit_character_lcd
3-
from board import *
4+
from board import D7, D8, D9, D10, D11, D12, D13
45

56
lcd_columns = 16
67
lcd_rows = 2
@@ -11,21 +12,23 @@
1112
lcd_d5 = digitalio.DigitalInOut(D10)
1213
lcd_d4 = digitalio.DigitalInOut(D9)
1314
lcd_backlight = digitalio.DigitalInOut(D13)
14-
lcd = adafruit_character_lcd.Character_LCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
15+
lcd = adafruit_character_lcd.Character_LCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6,
16+
lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
1517

16-
head = [31,17,27,17,17,21,17,31]
18+
head = [31, 17, 27, 17, 17, 21, 17, 31]
1719

18-
top_body = [31,0,31,0,18,8,2,8]
19-
top_left_corner_body = [31,16,16,17,22,20,20,20]
20-
top_right_corner_body = [31,1,1,17,13,5,5,5]
20+
top_body = [31, 0, 31, 0, 18, 8, 2, 8]
21+
top_left_corner_body = [31, 16, 16, 17, 22, 20, 20, 20]
22+
top_right_corner_body = [31, 1, 1, 17, 13, 5, 5, 5]
2123

22-
# these three chars will be the above three reversed with a few minor changes to fit feet into the bottom
24+
# these three chars will be the above three reversed with a few minor changes to
25+
# fit feet into the bottom
2326
bot_body = []
2427
bot_left_corner_body = []
2528
bot_right_corner_body = []
2629

27-
tail_neutral = [0,0,0,0,31,31,0,0]
28-
tail_up = [0,8,12,6,3,1,0,0]
30+
tail_neutral = [0, 0, 0, 0, 31, 31, 0, 0]
31+
tail_up = [0, 8, 12, 6, 3, 1, 0, 0]
2932

3033
for i in range(7, -1, -1):
3134
bot_body.append(top_body[i])
@@ -48,8 +51,8 @@
4851
bot_body2 = bot_body[:-1] + [3]
4952

5053

51-
rainbow = [0,0,6,25,11,29,27,12]
52-
rainbow2 = [0,0,6,31,13,5,23,12]
54+
rainbow = [0, 0, 6, 25, 11, 29, 27, 12]
55+
rainbow2 = [0, 0, 6, 31, 13, 5, 23, 12]
5356

5457
lcd.create_char(0, top_body)
5558
lcd.create_char(1, top_left_corner_body)
@@ -79,13 +82,13 @@
7982
lcd.message('\x05')
8083

8184
while True:
82-
lcd.create_char(4, bot_body2)
83-
lcd.create_char(7, tail_up)
84-
lcd.create_char(2, rainbow2)
85-
lcd.move_right()
86-
time.sleep(.4)
87-
lcd.create_char(4, bot_body)
88-
lcd.create_char(7, tail_neutral)
89-
lcd.create_char(2, rainbow)
90-
lcd.move_left()
91-
time.sleep(.4)
85+
lcd.create_char(4, bot_body2)
86+
lcd.create_char(7, tail_up)
87+
lcd.create_char(2, rainbow2)
88+
lcd.move_right()
89+
time.sleep(.4)
90+
lcd.create_char(4, bot_body)
91+
lcd.create_char(7, tail_neutral)
92+
lcd.create_char(2, rainbow)
93+
lcd.move_left()
94+
time.sleep(.4)

examples/customcharacter.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import time, math, digitalio
1+
import digitalio
22
import adafruit_character_lcd
3-
from board import *
4-
import analogio
3+
from board import D7, D8, D9, D10, D11, D12, D13
4+
5+
56
lcd_columns = 16
67
lcd_rows = 2
78
lcd_rs = digitalio.DigitalInOut(D7)
@@ -11,7 +12,8 @@
1112
lcd_d5 = digitalio.DigitalInOut(D10)
1213
lcd_d4 = digitalio.DigitalInOut(D9)
1314
lcd_backlight = digitalio.DigitalInOut(D13)
14-
lcd = adafruit_character_lcd.Character_LCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
15-
checkmark = bytes([0x0,0x0,0x1,0x3,0x16,0x1c,0x8,0x0])
15+
lcd = adafruit_character_lcd.Character_LCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6,
16+
lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
17+
checkmark = bytes([0x0, 0x0, 0x1, 0x3, 0x16, 0x1c, 0x8, 0x0])
1618
lcd.clear()
1719
lcd.message('\x00')

examples/hello_CircuitPython.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
- CircuitPython_CharLCD Module
77
"""
88

9-
import time, math, digitalio
9+
import time
10+
import digitalio
1011
import adafruit_character_lcd
11-
from board import *
12+
from board import D7, D8, D9, D10, D11, D12, D13
1213

1314
# Character LCD Config:
1415
# modify this if you have a different sized charlcd
@@ -25,7 +26,8 @@
2526
lcd_backlight = digitalio.DigitalInOut(D13)
2627

2728
# Init the lcd class
28-
lcd = adafruit_character_lcd.Character_LCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
29+
lcd = adafruit_character_lcd.Character_LCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6,
30+
lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
2931

3032
# Print a 2x line message
3133
lcd.message('hello\ncircuitpython')
@@ -50,8 +52,8 @@
5052
lcd.message(scroll_msg)
5153
# Scroll to the left
5254
for i in range(lcd_columns - len(scroll_msg)):
53-
time.sleep(0.5)
54-
lcd.move_left()
55+
time.sleep(0.5)
56+
lcd.move_left()
5557
# Demo turning backlight off
5658
lcd.clear()
5759
lcd.message("going to sleep\ncya later!")

examples/hello_CircuitPython_I2C.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Hello World using 16x2 character lcd and an MCP23008 I2C LCD backpack.
2-
import math
32
import time
43

54
import board
@@ -42,8 +41,8 @@
4241
lcd.message(scroll_msg)
4342
# Scroll to the left
4443
for i in range(lcd_columns - len(scroll_msg)):
45-
time.sleep(0.5)
46-
lcd.move_left()
44+
time.sleep(0.5)
45+
lcd.move_left()
4746
# Demo turning backlight off
4847
lcd.clear()
4948
lcd.message("going to sleep\ncya later!")

examples/hello_CircuitPython_SPI.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Hello World using 16x2 character lcd and an 74LS595 SPI LCD backpack.
2-
import math
32
import time
43

54
import board
@@ -15,9 +14,9 @@
1514
lcd_rows = 2
1615

1716
# Backpack connection configuration:
18-
clk = board.SCK # Pin connected to backpack CLK.
19-
data = board.MOSI # Pin connected to backpack DAT/data.
20-
latch = board.D5 # Pin connected to backpack LAT/latch.
17+
clk = board.SCK # Pin connected to backpack CLK.
18+
data = board.MOSI # Pin connected to backpack DAT/data.
19+
latch = board.D5 # Pin connected to backpack LAT/latch.
2120

2221
# Initialize SPI bus.
2322
spi = busio.SPI(clk, MOSI=data)
@@ -49,8 +48,8 @@
4948
lcd.message(scroll_msg)
5049
# Scroll to the left
5150
for i in range(lcd_columns - len(scroll_msg)):
52-
time.sleep(0.5)
53-
lcd.move_left()
51+
time.sleep(0.5)
52+
lcd.move_left()
5453
# Demo turning backlight off
5554
lcd.clear()
5655
lcd.message("going to sleep\ncya later!")

examples/rgb_hello_CircuitPython.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import time, math, digitalio
1+
import time
2+
import digitalio
23
import adafruit_character_lcd
34
import pulseio
4-
from board import *
5+
from board import D3, D4, D5, D7, D8, D9, D10, D11, D12, D13
56

67
# Character LCD Config:
78
# modify this if you have a different sized charlcd
@@ -21,12 +22,16 @@
2122
blue = pulseio.PWMOut(D5)
2223

2324
# Init the lcd class
24-
lcd = adafruit_character_lcd.Character_LCD_RGB(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, red, green, blue, lcd_backlight)
25+
lcd = adafruit_character_lcd.Character_LCD_RGB(lcd_rs, lcd_en, lcd_d4, lcd_d5,
26+
lcd_d6, lcd_d7, lcd_columns, lcd_rows,
27+
red, green, blue, lcd_backlight)
2528

29+
#pylint: disable-msg=bad-whitespace
2630
# only red
2731
RED = [100, 0, 0]
2832
GREEN = [0, 100, 0]
2933
BLUE = [0, 0, 100]
34+
#pylint: enable-msg=bad-whitespace
3035

3136
while True:
3237
lcd.message('CircuitPython\nRGB Test')

0 commit comments

Comments
 (0)