Controlling the LED
Hi,
I can't find any information how to control the LED's.
Can you give me a hint?
I can't find any information how to control the LED's.
Can you give me a hint?
Hello,
if you mean the LEDs A1 and A2 on the RevPi Core, then take a look at: https://revolution.kunbus.com/tutorials ... -am-revpi/
if you mean the LEDs A1 and A2 on the RevPi Core, then take a look at: https://revolution.kunbus.com/tutorials ... -am-revpi/
Thank's for the answer. I will have a look at it.
I am running our on daemons on the Pi Core based on python and c code and will be controlling the LED to indicate if the unit is online or not on our trendlog.io platform.
On which address / port is the LEDs?
I am running our on daemons on the Pi Core based on python and c code and will be controlling the LED to indicate if the unit is online or not on our trendlog.io platform.
On which address / port is the LEDs?
- RevPiModIO
- KUNBUS
- Posts: 335
- Joined: 20 Jan 2017, 08:44
- Contact:
If you are using Python with RevPiModIO, you can control the LEDs like:
https://revpimodio.org/en/homepage/
If you have just a Core/Connect which is configured via piCtory you will find the LED in Byte 6 of the process image.
Regards, Sven
https://revpimodio.org/en/homepage/
Code: Select all
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Will just flash LED A1 till SIGINT / SIGTERM."""
import revpimodio2
rpi = revpimodio2.RevPiModIO(autorefresh=True)
rpi.handlesignalend()
while not rpi.exitsignal.wait(0.5):
rpi.core.a1green.value = not rpi.core.a1green.value
If you have just a Core/Connect which is configured via piCtory you will find the LED in Byte 6 of the process image.
Code: Select all
pi@RevPi0000:~ $ piTest -v RevPiLED
variable name: RevPiLED
offset: 6
length: 8
bit: 0
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
@lms:
Think there is a misunderstanding: No ports, no direct addressing! On a RevPi System all IOs are operated by the kernel driver piControl, this includes the two bi-colour LEDs. You need to call this driver by opening it like a file and write to a certain offset your control byte which is setting the outputs. The kernel driver then does operate GPIOs (in case of the LEDSs) or any other system components to set or reset outputs and read inputs. The memory you are exchanging process data with is called "central process image" and is 4 KB of size. It always contains the actual state of all outputs and inputs of the overall system (including DIO or AIO modules).
If you are using C then please follow the example you find in your home/demo directory of the RevPi Core. If you are using python you may use the library Sven has pointed out to you which is wrapping the bits and bytes stuff so that it is more easy to be used.
Think there is a misunderstanding: No ports, no direct addressing! On a RevPi System all IOs are operated by the kernel driver piControl, this includes the two bi-colour LEDs. You need to call this driver by opening it like a file and write to a certain offset your control byte which is setting the outputs. The kernel driver then does operate GPIOs (in case of the LEDSs) or any other system components to set or reset outputs and read inputs. The memory you are exchanging process data with is called "central process image" and is 4 KB of size. It always contains the actual state of all outputs and inputs of the overall system (including DIO or AIO modules).
If you are using C then please follow the example you find in your home/demo directory of the RevPi Core. If you are using python you may use the library Sven has pointed out to you which is wrapping the bits and bytes stuff so that it is more easy to be used.
Unser RevPi Motto: Don't just claim it - make it!
@vokler:
Thank you for the explanation. I installed a new image (Rasperian) on the RevPi Core. Can I still use the piControl driver?
Thank you for the explanation. I installed a new image (Rasperian) on the RevPi Core. Can I still use the piControl driver?
The original image from the Raspberry Pi foundation does not contain the piControl package. Also there is no real time patch applied to the kernel. You are free to use our GitHub repository to add this functionality by yourself. But it would be easier for you to use the images which are available in our shop.
Hi,
Just went on trial and error basis trying all the GPIO ports out. Found that with python you can control the A1 and A2 leds with a small piece of code
Just went on trial and error basis trying all the GPIO ports out. Found that with python you can control the A1 and A2 leds with a small piece of code
Code: Select all
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
sleeptime = 0.2
while (True):
#red A1
GPIO.setup(6,GPIO.OUT)
print "LED on"
GPIO.output(6,GPIO.HIGH)
time.sleep(sleeptime)
print "LED off"
GPIO.output(6,GPIO.LOW)
time.sleep(sleeptime)
#green A1
GPIO.setup(30,GPIO.OUT)
print "LED on"
GPIO.output(30,GPIO.HIGH)
time.sleep(sleeptime)
print "LED off"
GPIO.output(30,GPIO.LOW)
time.sleep(sleeptime)
#red A2
GPIO.setup(33,GPIO.OUT)
print "LED on"
GPIO.output(33,GPIO.HIGH)
time.sleep(sleeptime)
print "LED off"
GPIO.output(33,GPIO.LOW)
time.sleep(sleeptime)
#green A2
GPIO.setup(32,GPIO.OUT)
print "LED on"
GPIO.output(32,GPIO.HIGH)
time.sleep(sleeptime)
print "LED off"
GPIO.output(32,GPIO.LOW)
time.sleep(sleeptime)
-
- Posts: 1
- Joined: 11 Dec 2019, 17:43
Hi...Multiplexed LEDS are indeed being switched on and off rapidly. Give the persistence of vision of your eyes you do not notice that.
Controlling and electromagnet is a different problem. Use different pins for that. You will need driver transistors, back EMF protection diodes, perhaps even opto-isolators, probably a separate power supply. Google will find hundreds of circuits an suggestions for doing that.
Controlling and electromagnet is a different problem. Use different pins for that. You will need driver transistors, back EMF protection diodes, perhaps even opto-isolators, probably a separate power supply. Google will find hundreds of circuits an suggestions for doing that.