Back to Browse

Raspberry Pi Workshop Kit Tutorials – 4 Push Button

2.4K views
Jun 15, 2017
5:47

Welcome to the Raspberry Pi Workshop Tutorials, brought to you by ModMyPi, BuyaPi.ca, and PiShop.us. In this series, we’ll demonstrate nine projects that can be made using the YouTube Workshop Kit for Raspberry Pi. These projects are a great way to familiarize yourself with the Pi’s input and output functions, as well as creating programs in Python that we’ll use to control the Pi’s hardware. Tutorial 4 - Push Button Circuit Diagram: http://www.modmypi.com/download/led_button_bb.png Tutorial 4 Download: http://www.modmypi.com/download/youtube_workshop_4_button.pdf View Tutorial Online: https://www.modmypi.com/blog/youtube-workshop-kit/gpio-and-python-49-push-button *** Code Used In This Tutorial *** #!/usr/bin/python import os from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) # setup our input pin # we use an internal pull up resistor to hold the pin at 3v3, otherwise the inputs value could chatter between high and low GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_UP) while True: if ( GPIO.input(10) == False ): print("Button Pressed") os.system('date') # print the systems date and time print GPIO.input(10) sleep(5) else: os.system('clear') # clear the screens text print ("Waiting for you to press a button") sleep(0.1)

Download

0 formats

No download links available.

Raspberry Pi Workshop Kit Tutorials – 4 Push Button | NatokHD