Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3843

Beginners • Re: GPIO to control led

$
0
0
Hello,
I have an issue with my gpio turning on an led
The wiring is all correct as I have tested my circuit connecting the long leg of my led to voltage.
I am using a raspberry pi 5.

import gpiod
LED_PIN = 17
chip = gpiod.Chip('gpiochip4')
ledline = chip.get_line(LED_PIN)
ledline.request(consumer="MYDEVICE", type=gpiod.LINE_REQ_DIR_OUT)
ledline.set_value(1)


What is the default behaviour of the gpiod library you are using in respect of what happens when the script terminates? (I genuinely don't know, I haven’t investigated that library yet.)

If its behaviour is to reset the line to where it found it, perhaps the script is working but you don't see the LED flash.

importing time and using

Code:

time.sleep(5)
after set_value() might shed some light?

Is your connection to Physical Pin #11?

Statistics: Posted by B.Goode — Tue Jul 16, 2024 2:57 pm



Viewing all articles
Browse latest Browse all 3843

Trending Articles