-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextstar.py
More file actions
28 lines (23 loc) · 824 Bytes
/
textstar.py
File metadata and controls
28 lines (23 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
### Textstar display ###
### Inspired by http://jeremyblythe.blogspot.dk/2012/07/raspberry-pi-with-textstar-serial-lcd.html ###
### Made by Joachim Kristensen 2017, https://www.hackster.io/lokefar
### Git: https://github.com/lokefar
### Ideas for optimization:
### - Set cursor starting point
### - Make graphs/special characters
### Code to use in main program
### import textstar
### textstar.TEXTSTAR(uart, 'clearDisplay') <-- I recommend always clearing before writing new string
### textstar.TEXTSTAR(uart, 'MyString')
#Adresse for clearing display
CLEARDISPLAY = chr(12)
class TEXTSTAR:
def __init__(self, uart, text):
self.uart = uart
self.text = text
if self.text == 'clearDisplay':
self.uart.write(CLEARDISPLAY)
else:
self.writeText(self.text)
def writeText(self, text):
self.uart.write(text)