Created
June 5, 2023 10:43
-
-
Save simonprickett/8689217928e1e2100fe348cc237d5de1 to your computer and use it in GitHub Desktop.
Flip dot Python example for Raspberry Pint meetup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyflipdot.pyflipdot import HanoverController | |
from pyflipdot.sign import HanoverSign | |
from serial import Serial | |
import random | |
import time | |
ser = Serial('/dev/ttyUSB0') | |
controller = HanoverController(ser) | |
sign = HanoverSign(address=6, width=84, height=7) | |
controller.add_sign('office', sign) | |
image = sign.create_image() | |
controller.draw_image(image) | |
while True: | |
x = random.randint(0, 83) | |
y = random.randint(0, 6) | |
image[y, x] = random.choice([True, False]) | |
print(f"{x} {y}") | |
controller.draw_image(image) | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment