Control Led by Pushbutton | Raspberry Pi 3 | Tutorial - 2

197

1

Posted in TechnologyRaspberry-pi

Introduction: Control Led by Pushbutton | Raspberry Pi 3 | Tutorial - 2

About: Advanced and latest technology tutorials on my youtube channel and now i started instructable so i will post one by one latest tutorial.

Requirements:

  1. Raspberry Pi
  2. Led
  3. Pushbutton
  4. BreadBoard or T-Cobbler
  5. Jumper Wires

Click here for More Information

Step 1: Setup

Connect led and Pushbutton as per Video or Photo and write the code and change it according to your connection on breadboard.

Step 2: Install Libraries for GPIO

$ sudo apt-get update

$ sudo apt-get install python-rpi.gpio python3-rpi.gpio

Step 3: Python Program

import RPi.GPIO as GPIO

import time

GPIO.setmode(GPIO.BCM)

GPIO.setwarnings(False)

GPIO.setup(18,GPIO.OUT)

print "LED on"

GPIO.output(18,GPIO.HIGH)

time.sleep(1)

print "LED off"

GPIO.output(18,GPIO.LOW)

Step 4: Understand Program Lines

Read this all code line instruction for better understanding

Share

    Recommendations

    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Spotless Contest

      Spotless Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments