Code: Select all
1 import pyb
2 from lcd160cr import LCD160CR, PORTRAIT_UPSIDEDOWN
3
4
5 def test_ignitor(base_pin_name='Y12'):
6 pin = pyb.Pin(base_pin_name)
7 lcd = LCD160CR('X')
8 lcd.set_orient(PORTRAIT_UPSIDEDOWN)
9 lcd.set_text_color(lcd.rgb(255, 0, 0), lcd.rgb(0, 0, 0))
10 lcd.set_font(3)
11 lcd.erase()
12
13 with open('/sd/frames/nuclear.jpg', 'r') as f:
14 nuclear = f.read()
15
16 countdown = 15000
17 remaining = countdown
18 start = pyb.millis()
19
20 while True:
21 remaining = countdown - pyb.elapsed_millis(start)
22 lcd.erase()
23 lcd.set_pos(0, 0)
24
25 if remaining <= 0:
26 break
27
28 lcd.write('{}'.format(remaining))
29
30 pyb.delay(50)
31
32 lcd.erase()
33 lcd.set_pos(0, 0)
34 lcd.jpeg(nuclear)