I am running ubuntu on a raspberry pi and I cannot figure out how to activate the GPIO pins. I am trying to activate a python script with a button press.
Here is my script:
import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP) while True: input_state = GPIO.input(18) if input_state == False: os.system('python backup.py') time.sleep(0.2) GPIO.cleanup()
When I run this I get an error that says; no such import as import RPi.GPIO as GPIO
Any help would be appreciated.