In this task, we will implement the marquee control for our arcade game. We will display information such as the player's turn (whether it is the computer or the human player's turn), the winner of the game at the end (or whether it was a tie), or game-specific messages on the marquee. We will use the Pi Lite LED Matrix display (http://shop.ciseco.co.uk/pi-lite-lots-of-leds-for-the-raspberry-pi-1206-red/) that can be used to scroll messages across the display.
The Pi Lite display can be purchased from the Ciseco PLC website (http://shop.ciseco.co.uk/pi-lite-lots-of-leds-for-the-raspberry-pi-1206-red/). The display costs about 33 USD.
One of the requirements is the serial library, which is required to control the display. It can be installed as follows:
sudo apt-get install python-serial
Once we are done installing the module, we should be able to import the module and start programming the messages in our game. The Ciseco Pi-Lite GitHub repository comes with examples such as the Bar Scroll example. It is essential that you download such examples and test if the python-serial module is functionally correct.
import serial serialport = serial.Serial() serialport.baudrate = 9600 serialport.timeout = 0 serialport.port = "/dev/ttyAMA0"
try: serialport.open() except serial.SerialException, e: sys.stderr.write("could not open port %r: %s " % (port, e))
column = pfio.read_input() serialport.write("Welcome to Connect Four Game") pygame.display.update()
3.133.159.224