Example #1
0
def drawBoard(board):
    # This function prints out the board that it was passed.

    # "board" is a list of 10 strings representing the board (ignore index 0)
    turn_all_off()
    for i, b in enumerate(board[1:10]):
        if b.lower() == 'x':
            blink_on(i)
        elif b.lower() == 'o':
            switch_on(i)
        else:
            switch_off(i)
            blink_off(i)
Example #2
0
def cleanup():
    turn_all_off()
    rpiledmatrix.cleanup()
    prompt("All is well")
Example #3
0
#!/usr/bin/env python
NXT_TST_INTERVAL = 1
NEW_ROUND_INTERVAL = 2
TOGGLE_INTERVAL = 0.5   
from rpiledmatrix import switch_on, switch_off, turn_all_off, cleanup, blink_on, blink_off, LED_INDICES
import time as time

def blink_on_serial():
    for led in LED_INDICES:
        blink_on(led)
        time.sleep(TOGGLE_INTERVAL)
        blink_off(led)
        pass

def steady_on_serial():
    for led in LED_INDICES:
        switch_on(led)
        time.sleep(TOGGLE_INTERVAL)
        switch_off(led)
        pass
try:
    while True:
        steady_on_serial()
        time.sleep(NXT_TST_INTERVAL)
        blink_on_serial()
        time.sleep(NEW_ROUND_INTERVAL)
except KeyboardInterrupt:
    turn_all_off()
finally:
    cleanup()