SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
(continued from previous page)
rection_time
=
utime
.
ticks_diff(utime
.
ticks_ms(), timer_light_off)
if
pin
==
left_button:
(
"Left player is winner!"
)
elif
pin
==
right_button:
(
"Right player is winner!"
)
(
"Your reaction time was "
+
str
(rection_time)
+
" milliseconds!"
)
led
.
value(
1
)
utime
.
sleep(urandom
.
uniform(
5
,
10
))
led
.
value(
0
)
timer_light_off
=
utime
.
ticks_ms()
right_button
.
irq(trigger
=
machine
.
Pin
.
IRQ_RISING, handler
=
button_press)
left_button
.
irq(trigger
=
machine
.
Pin
.
IRQ_RISING, handler
=
button_press)
3.4.5 Traffic Light
In addition to home electronic devices, many microcontrollers can also be found in the social environment, including
traffic lights. Traffic lights are used to direct traffic operation and are generally composed of red, green, and yellow
lights. Building a huge traffic management system is a fairly advanced project, but using Pico to drive a miniature
traffic light is a project we can try.
Let’s make a mini pedestrian crossing system with a few LEDs and a button!
Wiring
1. Connect 3V3 and GND of Pico to the breadboard power bus.
2. Insert the green, yellow and red LEDs on the breadboard.
3. GP13, GP14, GP15 are each connected to a 220 resistor and then connected to the anode of the LED.
4. Connect the cathodes of the LEDs to the negative power bus of the breadboard.
64
Chapter 3. For MicroPython User
Summary of Contents for Thales Kit
Page 1: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 Jimmy SunFounder Jun 04 2021 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 CONTENTS ...
Page 140: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 136 Chapter 3 For MicroPython User ...
Page 164: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 160 Chapter 4 For Arduino User ...