GPIO Pins Rpi 3 Python

Asked

Viewed 113 times

0

I’m starting with a project with my rpi 3 that concise in using engines connected to the rpi3 gpio pins!

In my code there is some error connected in the mode of the pins, but I do not know how to solve, SOMEONE COULD GIVE A LITTLE HELP?

 import RPi.GPIO as gpio

def up():
    gpio.setmode(gpio.BCM)
    gpio.output(7,False)
    gpio.output(11,True)
    gpio.output(13,False)
    gpio.output(15,True)

up()
gpio.cleanup()

program output --> output

  • Do not put the error as image, copy and paste here in the editor.

1 answer

0


You need to configure the GPIO.OUT. Look at the example below used to manipulate LED.

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(24,GPIO.OUT)
print "LED on"
GPIO.output(24,GPIO.HIGH)
time.sleep(1)
print "LED off"
GPIO.output(24,GPIO.LOW)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.