SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
Buttons require pull-up resistors or pull-down resistors. If there is no pull-up or pull-down resistor,
the main controller may receive a ‘noisy’ signal which can trigger even when you’re not pushing the
button.
6. Connect the negative power bus of the breadboard to Pico’s GND.
Code
When the button is pressed, the current will flow from 3V3 through the button to GP14, in other words, GP14 will
read a high-level signal ‘1’; otherwise, it will read a low-level signal ‘0’.
import
machine
import
utime
button
=
machine
.
Pin(
14
, machine
.
Pin
.
IN)
while
True
:
if
button
.
value()
==
1
:
(
"You pressed the button!"
)
utime
.
sleep(
1
)
Pull-up Working Mode
Next is the wiring and code when the button in the pull-up working mode, please try it.
56
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 ...