Skip to content

Instantly share code, notes, and snippets.

@toddmilne13
Last active January 17, 2017 10:31
Show Gist options
  • Save toddmilne13/f1e36fc51274b82bb33a1378a02fa0ab to your computer and use it in GitHub Desktop.
Save toddmilne13/f1e36fc51274b82bb33a1378a02fa0ab to your computer and use it in GitHub Desktop.
STJLOL-TM-Code
#code to make rover move forward
#the setup
import RPi.GPIO as GPIO # importing the raspberry as GPIO
from time import sleep #importing sleep to the program
GPIO.setmode(GPIO.BCM) #setting mode to BCM
GPIO.setup(23, GPIO.OUT) #setting up left motor
GPIO.setup(17, GPIO.OUT) #setting up right motor
#the code
GPIO.output(17, GPIO.HIGH) #turning on right motor
GPIO.output(23, GPIO.HIGH) #turning on left motor
sleep(5) #running
GPIO.output(23, GPIO.LOW) #turning off left motor
GPIO.output(17, GPIO.LOW) #turning on right motor
#the cleanup
GPIO.cleanup() #cleaning up any bugs, walls ect...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment