I'm trying to learn how to do some cool things with my Raspberry Pi. I am trying to run a NMOS transistor with the 3.3V gpio pin on my raspberry pi. I am pretty sure it is capable of 3.3V output, but i keep on getting an error. I checked my wiring and my code. I don't see any problems. Please take a look at my code below and let me know if you see anything wrong. Thanks!
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(12,GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(17,GPIO.OUT)
GPIO.output(17,GPIO.HIGH)
while True:
input_state = GPIO.input(12)
if input_state == False:
#command for running 5v/3.3v output below
GPIO.output(17,GPIO.LOW)
time.sleep(3.5)
GPIO.output(17,GPIO.HIGH)
I ran my script using "sudo python myscript.py". This is the error I keep getting:
GPIO.setup(17,GPIO.OUT) ValueError: The channel sent is invalid on a Raspberry Pi