Python Tutorials – பாடம் 4 – Single LED Control With Single Pushbutton

ஒரு புஷ் பட்டன் ஐ பயன்படுத்தி ஒரு LEDஐ ஒளிர வைப்பது

Required Components

  1. LED-1 no
  2. 220 Ω Resistor-1 no
  3. 10 K Ω Resistor-1 no
  4. Pushbutton-1 no
  5. Bread Board-1 no
  6. Raspberry Pi Pico-1 no
  7. Connecting wires-1 Set

Circuit

Steps

  1. நாம் பயன்படுத்தும் உபகரணங்கள் சரியாக வேலை செய்கிறதா என்பதை உறுதி செய்து கொள்ளவும்.
  2. இரண்டு வகையான மின்தடைகளை எடுத்து கொள்ளவும் ஒன்று 10K மற்றறொன்று 220 Ohm.
  3. 220Ohm மின்தடையை LED உடனும் 10K மின்தடையை சுவிட்ச் உடனும் இணைக்க வேண்டும்.
  4. அந்த புஷ்பட்டன் ஐ Raspberry Pi Pico GP17 உடன் இணைக்க வேண்டும்.
  5. 220Ohm மின்தடையை LED + உடன் மற்றும் LED – ஐ GND உடன் இணைக்க வேண்டும்.
  6. 220Ohm மின்தடையை Raspberry Pi Pico GP16 உடன் இணைக்க வேண்டும்.
  7. புஷ் பட்டன் ஐ அழுத்தும் போது LED ஒளிர வேண்டும்.
  8. Python program ஐ சரி பார்க்க வேண்டும்.
  9. மின்சுற்றை சரி பார்க்க வேண்டும்.
  10. 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)   

Arduino Tutorials – பாடம் 39 – Single LED Control With Single Pushbutton

ஒரு புஷ் பட்டன் ஐ பயன்படுத்தி ஒரு LEDஐ ஒளிர வைப்பது

Required Components

  1. LED-1 no
  2. 220 Ω Resistor-1 no
  3. 10 K Ω Resistor-1 no
  4. Pushbutton-1 no
  5. Bread Board-1 no
  6. Raspberry Pi Pico-1 no
  7. Connecting wires-1 Set

Circuit

Steps

  1. நாம் பயன்படுத்தும் உபகரணங்கள் சரியாக வேலை செய்கிறதா என்பதை உறுதி செய்து கொள்ளவும்.
  2. இரண்டு வகையான மின்தடைகளை எடுத்து கொள்ளவும் ஒன்று 10K மற்றறொன்று 220 Ohm.
  3. 220Ohm மின்தடையை LED உடனும் 10K மின்தடையை சுவிட்ச் உடனும் இணைக்க வேண்டும்.
  4. அந்த புஷ்பட்டன் ஐ Raspberry Pi Pico GP17 உடன் இணைக்க வேண்டும்.
  5. 220Ohm மின்தடையை LED + உடன் மற்றும் LED – ஐ GND உடன் இணைக்க வேண்டும்.
  6. 220Ohm மின்தடையை Raspberry Pi Pico GP16 உடன் இணைக்க வேண்டும்.
  7. புஷ் பட்டன் ஐ அழுத்தும் போது LED ஒளிர வேண்டும்.
  8. Arduino program ஐ சரி பார்க்க வேண்டும்.
  9. மின்சுற்றை சரி பார்க்க வேண்டும்.
  10. Arduino program ஐ ரன் செய்ய வேண்டும்.

Arduino Program

int ledPin = 16;
int buttonPin = 17;

void setup()
{
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
}


void loop()
{  
  int button = digitalRead(buttonPin);
  if (button==HIGH)
  {
    digitalWrite(ledPin,HIGH);
  } 
  else
  {
    digitalWrite(ledPin, LOW);
  }
}

Python Tutorials – Lesson 4 –Single LED Control With Single Pushbutton

To check single LED blink using push button

Required Components

  1. LED _ 1 no
  2. 220 Ω Resistor_ 1 no
  3. 10 K Ω Resistor _1 no
  4. Pushbutton _1 no
  5. Bread Board _1 no
  6. Raspberry Pi Pico _1 no
  7. Connecting wires _1 Set

Circuit

Steps

  1. Make sure the components are working properly.
  2. Connect Raspberry Pi Pico board VBus and GND pin to the bread board by using wires.
  3. Connect 220 Ω Resistor to the LED Anode (+) pin and LED cathode (-) pin to Gnd.
  4. Connect 220 Ω Resistor another pin to GP16.
  5. Connect 10 k Ω Resistor to the switch button.
  6. Connect switch button another pin to the Raspberry Pi Pico pin GP17.
  7. When we press the push button LED blinks.
  8. Check the Python program.
  9. Check the circuit connections.
  10. 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)    

Arduino Tutorials – Lesson 39 – Single LED Control With Single Pushbutton

To check single LED blink using push button

Required Components

  1. LED _ 1 no
  2. 220 Ω Resistor_ 1 no
  3. 10 K Ω Resistor _1 no
  4. Pushbutton _1 no
  5. Bread Board _1 no
  6. Raspberry Pi Pico _1 no
  7. Connecting wires _1 Set

Circuit

Steps

  1. Make sure the components are working properly.
  2. Connect Raspberry Pi Pico board VBus and GND pin to the bread board by using wires.
  3. Connect 220 Ω Resistor to the LED Anode (+) pin and cathode (-) pin to Gnd.
  4. Connect 220 Ω Resistor another pin to GP16.
  5. Connect 10 k Ω Resistor to the switch button.
  6. Connect switch button another pin to the Raspberry Pi Pico pin GP17.
  7. When we press the push button LED blinks.
  8. Check the Arduino program.
  9. Check the circuit connections.
  10. Run the Arduino program.

Arduino Program

int ledPin = 16;
int buttonPin = 17;

void setup()
{
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
}


void loop()
{  
  int button = digitalRead(buttonPin);
  if (button==HIGH)
  {
    digitalWrite(ledPin,HIGH);
  } 
  else
  {
    digitalWrite(ledPin, LOW);
   }
}