0
0 items
Rp0
No products in the cart.
Last Offers
Rp50.000 Rp45.000
Rp45.000 Rp37.500
Rp3.015.000 Rp2.950.000
Rp565.000 Rp550.000
Rp685.000 Rp600.000
Raspberry Pi Pico / Pico W Sensor Shield Developer Board
Shield ESP32 Wroom DevkitC V4 38PIN
Seeed Studio Industrial pH Meter / Sensor RS485 Modbus
Arduino Ethernet Shield 2
Arduino Mega 2560 Rev3 ATmega2560
LED Control Dengan Push Button Di Pi Pico
Persiapan Bahan #
– Raspberry Pi Pico / Pico W
– LED
– Breadboard
– Push Button
– Kabel Jumper Male to Male
– Kabel Micro USD
– Aplikasi Thonny IDE
Wiring LED dan Push Button dengan Raspberry Pi Pico #
- Connect the Push Button Pin to GP0 & its cross pin to GND.
- Connect the LED positive Pin to Raspberry Pi Pico GP1 Pin
- Negative Pin LED to GND Pin.
Sampling Code #
from machine import Pin
from utime import sleep_ms
button = Pin(0, Pin.IN, Pin.PULL_UP) #Internal pull-up
led = Pin(1, Pin.OUT)
State=0 #0 means that the light is currently off
if __name__ == '__main__':
while True:
print(button.value())
if button.value() == 0: #key press
if State==0:
led.value(1)
sleep_ms=100
while button.value() == 0:
State=1
else:
led.value(0)
sleep_ms=100
while button.value()== 0:
State=0
Run the script and you can start checking the LED State by pressing the button.
When a button is pressed the LED will turn ON.
Updated on 11/01/2023
Join our newsletter for £10 offs
Get our emails for info on new items, sales and much more.
Register now to get latest updates on promotions & coupons. Don’t worry, we not spam!
Völogi deledes ponade eujäjurtad
Autoseligen syr. Nek diarask fröbomba. Nör antipol kynoda nynat. Pressa fåmoska. Aposkop redelingar nede, sektigt.
Need Help?
Customer Service
Store Information
- -5% for all order in this week Shop now
- Free delivery for all orders over $200