SHARE
TWEET

Untitled

a guest Apr 20th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import time
  2.  import RPi.GPIO
  3.  
  4.  # Initializing the GPIO pins. The numbering using is board.
  5.  RPi.GPIO.setmode(RPi.GPIO.BOARD)
  6.  
  7.  # Configuring the GPIO pin number 8 to be an output pin.
  8.  RPi.GPIO.setup(8, RPi.GPIO.OUT)
  9.  
  10.  print("Running Motor.")
  11.  # Running the motor by changing the GPIO output pin state to high.
  12.  RPi.GPIO.output(8, RPi.GPIO.HIGH)
  13.  
  14.  # Leave the motor running for 3 seconds.
  15.  time.sleep(3)
  16.  
  17.  # Stop the motor by changing the GPIO output pin state back to low.
  18.  RPi.GPIO.output(8, RPi.GPIO.LOW)
  19.  
  20.  # cleanup all GPIO pins.
  21.  print("Clean Up GPIO.")
  22.  RPi.GPIO.cleanup()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top