Having a bit of bother getting the simple text example working.
It compiles and runs fine but no text on the Phat, the shell shows the following:
python simple-text-scroll.py “message” press CTRL-C to exit
The Phat works fine with all the other examples but i cant figure this one out.
Im am guessing that the required text goes in the speak marks as shown below?
Any help appreciated:
import scrollphat
import sys
import time
if len(sys.argv) != 2:
print("\nusage: python simple-text-scroll.py \"message\" \npress CTRL-C to exit\n")
sys.exit(0)
scrollphat.write_string(sys.argv[1] + "HELLO WORLD ")
while True:
scrollphat.scroll()
time.sleep(0.1)
Ooh, how are you running it? You should do something like:
python simple-text-scroll.py "Hello this is my text!"
It accepts the text string on the command line. The " " at the end of the write_string line only serves to pad it with spaces so it wraps nicely.
The len(sys.argv) != 2: line is checking to see how many arguments are being passed to the script. By default all scripts get their name passed as the first argument, but this script is expecting at least 2 arguments- the second being the text string to display.