SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
1. Connect 3V3 and GND of Pico to the power bus of the breadboard.
2. Connect the anode lead of the LED to the positive power bus via a 220 resistor.
3. Connect the cathode lead of the LED to the
emitter
lead of the transistor.
4. Connect the base lead of the transistor to the GP15 pin through a 1k resistor.
5. Connect the
collector
lead of the transistor to the negative power bus.
6. Connect one side of the button to the GP14 pin, and use a 10k resistor connect the same side and
negative power bus. The other side to the positive power bus.
Code
Two kinds of transistors can be controlled with the same code. When we press the button, Pico will send a high-level
signal to the transistor; when we release it, it will send a low-level signal. We can see that diametrically opposite
phenomena have occurred in the two circuits. The circuit using the NPN transistor will light up when the button is
pressed, which means it is receiving a high-level conduction circuit; The circuit that uses the PNP transistor will light
up when it is released, which means it is receiving a low-level conduction circuit.
import
machine
button
=
machine
.
Pin(
14
, machine
.
Pin
.
IN)
signal
=
machine
.
Pin(
15
, machine
.
Pin
.
OUT)
while
True
:
button_status
=
button
.
value()
if
button_status
==
1
:
signal
.
value(
1
)
elif
button_status
==
0
:
signal
.
value(
0
)
3.4. Projects
71
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 ...