blob: d6d8bdce1a72db0f98efa6e9643c1bfb743eb979 (
plain)
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
|
import sys
import time
from .led_output import Matrix
from .usb_input import Gamepad
from .state_machine import StateMachine
def main():
"Main function"
inpt = Gamepad()
mtrx = Matrix()
sm = StateMachine(mtrx, inpt)
while True:
tstart = time.time()
sm.tick()
trest = (1/30) - (time.time() - tstart)
if trest > 0:
time.sleep(trest)
else:
print("Output took too long!!")
sys.stdout.flush()
if __name__ == '__main__':
main()
|