ஒரு புஷ் பட்டன் ஐ பயன்படுத்தி ஒரு LEDஐ ஒளிர வைப்பது
Required Components
LED-1 no
220 Ω Resistor-1 no
10 K Ω Resistor-1 no
Pushbutton-1 no
Bread Board-1 no
Raspberry Pi Pico-1 no
Connecting wires-1 Set
Circuit
Steps
நாம் பயன்படுத்தும் உபகரணங்கள் சரியாக வேலை செய்கிறதா என்பதை உறுதி செய்து கொள்ளவும்.
இரண்டு வகையான மின்தடைகளை எடுத்து கொள்ளவும் ஒன்று 10K மற்றறொன்று 220 Ohm.
220Ohm மின்தடையை LED உடனும் 10K மின்தடையை சுவிட்ச் உடனும் இணைக்க வேண்டும்.
அந்த புஷ்பட்டன் ஐ Raspberry Pi Pico GP17 உடன் இணைக்க வேண்டும்.
220Ohm மின்தடையை LED + உடன் மற்றும் LED – ஐ GND உடன் இணைக்க வேண்டும்.
220Ohm மின்தடையை Raspberry Pi Pico GP16 உடன் இணைக்க வேண்டும்.
புஷ் பட்டன் ஐ அழுத்தும் போது LED ஒளிர வேண்டும்.
Python program ஐ சரி பார்க்க வேண்டும்.
மின்சுற்றை சரி பார்க்க வேண்டும்.
Python program ஐ ரன் செய்ய வேண்டும்.
Python Program
from machine import Pin
from time import sleep
led_pin = Pin(16, Pin.OUT) # 16 number in is Output
push_button = Pin(17, Pin.IN) # 17 number pin is input
while True:
logic_state = push_button.value()
if logic_state == True: # if push_button pressed
led_pin.value(1) # led will turn ON
else: # if push_button not pressed
led_pin.value(0)
Connect Raspberry Pi Pico board VBus and GND pin to the bread board by using wires.
Connect 220 Ω Resistor to the LED Anode (+) pin and LED cathode (-) pin to Gnd.
Connect 220 Ω Resistor another pin to GP16.
Connect 10 k Ω Resistor to the switch button.
Connect switch button another pin to the Raspberry Pi Pico pin GP17.
When we press the push button LED blinks.
Check the Python program.
Check the circuit connections.
Run the Python program.
Python Program
from machine import Pin
from time import sleep
led_pin = Pin(16, Pin.OUT) # 16 number in is Output
push_button = Pin(17, Pin.IN) # 17 number pin is input
while True:
logic_state = push_button.value()
if logic_state == True: # if push_button pressed
led_pin.value(1) # led will turn ON
else: # if push_button not pressed
led_pin.value(0)