This picture shows a sample of the text. It supports colors as two sizes of text.
This is the wiring chart:
LCD
|
Raspberry Pi
|
1 – Vcc
|
Pin 1
|
2 - Gnd
|
Pin 6
|
3 - CS
|
Pin 24/GPIO8/CE0
|
4 – RST
|
Pin 18/GPIO24
|
5 – D/C
|
Pin 16/GPIO23
|
6 – SDI/MOSI
|
Pin 19/GPIO10/MOSI
|
7 – SCK
|
Pin 23/GPIO11/SCLK
|
8 – LCD
|
10 ohms to Vcc
|
9 – SDO/MISO
|
NC
|
10-14
|
NC
|
This is the code to display the bmp graphics:
def Image (filename):
Write_CD (( 0X2A,
0X00, 0X00, 0X00, 0XEf )) #240 Columns
Write_CD (( 0X2B,
0X00, 0X00, 0X01, 0X3F )) #320 rows
Write_cmd ( 0X2C ) #
Next: red, Green, Blue bytes
GPIO.output (RS,
True ) # RS = 1 will send data
try: # Prevents crashing when images do not work
with
open(filename, 'rb') as bitmap: # Must be 240x240-320 image
for x in range (
0,320 ):
pixline = []
for y in range
( 0,720 ): # 720=240*3
bitmap.seek(0x36 + x*720 + (719-y)) # 36 is header size
Pixel =
ord(bitmap.read(1)) # 719-y reverses image horizontally
pixline.append (Pixel)
spi.writebytes
(pixline)
except:
pass
No comments:
Post a Comment