Skip to content

Instantly share code, notes, and snippets.

@15nmcgoldrick
Last active February 7, 2017 10:20
Show Gist options
  • Save 15nmcgoldrick/986fdee5510a6d53f9e74588f724be96 to your computer and use it in GitHub Desktop.
Save 15nmcgoldrick/986fdee5510a6d53f9e74588f724be96 to your computer and use it in GitHub Desktop.
rover code fam
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(23,GPIO.out)
GPIO.setup(17,GPIO.out)
GPIO.setup(16,GPIO.out)
#the code
GPIO.output(16,GPIO.HIGH) #turns green light on
GPIO.output(23, GPIO.HIGH) #turns motor on
sleep(5) #this allows the previous action to work for 5 seconds
GPIO.output(23,GPIO.LOW) #turns motor off
GPIO.output(16,GPIO.LOW) #turns green light off
GPIO.output(23,GPIO.HIGH)
GPIO.output(17,GPIO.HIGH)
sleep(5)
GPIO.output(23,GPIO.LOW)
GPIO.output(17,GPIO.LOW)
cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment