Spaces:
Sleeping
Sleeping
File size: 1,080 Bytes
2db1521 3fd98da 2db1521 3fd98da 704ebec 2db1521 3fd98da 2db1521 0f35f15 3fd98da 0f35f15 2db1521 0f35f15 62bd48f 3fd98da 0f35f15 3fd98da 0f35f15 3fd98da 0f35f15 3fd98da 0f35f15 3fd98da 2db1521 0f35f15 2db1521 3fd98da |
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
from time import sleep
from playsound import playsound
from frontend import Frontend
from leds import LEDs, Color
frontend = Frontend()
leds = LEDs()
print("Testing audio output")
playsound('sample.mp3')
print("Audio playback ended")
try:
print("Testing EEG Frontend")
data = frontend.read_regs(0x00, 1)
assert data == [0x3E], "Wrong output"
print("EEG Frontend responsive")
print("Testing LEDs")
print("Aquisition LED")
leds.aquisition(True)
sleep(0.5)
leds.aquisition(False)
sleep(0.5)
leds.aquisition(True)
print("USER1 (PWM) LED")
for i in range(200):
red = (i % 10) * 10
blue = ((i % 100) // 10) * 10
leds.led1(red, 0, blue)
sleep(0.02)
print("USER2 (2-color) LED")
for state in [Color.RED, Color.BLUE, Color.PURPLE, Color.CLOSED] * 3:
leds.led2(state)
sleep(0.2)
print("USER3 LED")
for state in [Color.RED, Color.CLOSED] * 3:
leds.led3(state)
sleep(0.2)
print("LEDs testing ended")
finally:
frontend.close()
leds.close()
|