GPIO Pins RPi 3 Python

0

I'm starting with a project with my rpi 3 that concocts using engines connected to the gpio pins of rpi3!

In my code there are some errors connected to the mode of the pins, but I do not know how to solve, SOMEONE COULD GIVE A 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 - >

    
asked by anonymous 16.12.2017 / 13:54

1 answer

0

You need to set GPIO.OUT . Look at the example below used to manipulate LEDs.

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)
    
19.12.2017 / 21:28