Hi
Is there anyway to use GPIO’s to control leds?
deepening on which leds your refering to the answer is yes and no so please clarify
It’s some standart 5 mm led connected to the pins.
I used to have a setup where my Pi was in the chassis from an old DVD player so it looks like a standard piece of kit, and had an LED on the front panel. I had keymap which set the power button to run a python script that switched on/off an LED in the case’s front panel.
Not sure if this is what you are trying to do, but it was fairly simple to set up.
Firstly you need to install the addons to enable control of the GPIO pins:
sudo apt-get update
sudo apt-get install build-essential
export ARCH=arm
export CROSS_COMPILE=/usr/bin/
sudo pip install rpi.gpio
Then in the python script you set the pin you want to control as true:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
GPIO.output(7,True)
I don’t have my original code, but I’m pretty sure this is what I had. Hope this helps.
Thx for the advice.
I would like to have some leds light up (breathing via pwm) ones every 5 min.
But… When I try the last command (sudo pip install rpi.gpio). I get the following error:
Command “/usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-build-B3U7fW/rpi.gpio/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(’\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-AJscnn-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-B3U7fW/rpi.gpio
It is because I have installed pip in a wrong directory?