]>
vault307.fbx.one Git - mu_code.git/blob - warHammer.py
1 from machine
import Pin
, PWM
15 led0
=Pin(16,Pin
.OUT
) #BR1
16 led1
=Pin(17,Pin
.OUT
) #BR2
17 led2
=Pin(18,Pin
.OUT
) #BR3
18 led3
=Pin(19,Pin
.OUT
) #BR4
19 led4
=Pin(20,Pin
.OUT
) #BR5
20 br
=[led0
,led1
,led2
,led3
,led4
] #br[i].toggle()
22 ledD
=Pin(22,Pin
.OUT
) #blue LED
24 ledA
=Pin(21,Pin
.OUT
) #red LED
27 button0
=Pin(12,Pin
.IN
,Pin
.PULL_DOWN
) #control ledD&ledA
28 global button0_pressed
30 def button0_reader_thread():
31 global button0_pressed
33 if button0
.value()==1:
36 _thread
.start_new_thread(button0_reader_thread
,())
38 if button0_pressed
==True:
44 button1
=Pin(11,Pin
.IN
,Pin
.PULL_DOWN
) #control RGB and phases
45 global button1_pressed
51 def button1_reader_thread():
52 global button1_pressed
54 if button1
.value()==1:
58 if button1_pressed
==True:
61 # button0 will handle switching ledD(blue) and ledA(red) to indicate player turn
62 # led0-4 indicate battle round (1-5), light when command phase starts
63 # RGB indicates battle phase (command, movement, psychic, shooting, charge, fight, morale)
64 # button1 change battle phase, loop through 7 phases;start start new command phase=new battle round