Switch Interfacing with Raspberry Pi | Digital Input with Raspberry Pi

This tutorial provide step by step instruction to perform Switch Interfacing with Raspberry Pi and its Python program.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)

while True:
    input_state=GPIO.input(18)
    if input_state == False:
        print('Botton pressed')
    else:
        print('Buttom not pressed')
    time.sleep(1)
You can leave a response, or trackback from your own site.
Leave a Reply to the article

Learning & Certifications
Follow Us
Facebook Icon   Linked In Icon   Twitter Icon  
Validation and Recognition

Valid CSS! Valid HTML5!          Protected by Copyscape