Modbus RTU & RevPi DIO manage in Python script
Modbus RTU & RevPi DIO manage in Python script
I'm a new user on the RevPI Forum.
I bought a RevPi connect+ and a RevPi DIO module. I would like to control my devices with a Python script.
Would it be possible to receive some examples of python programs: to control an actuator in modbus RTU ( write and read coil & write and read registers with some values) and to control I/O with the DIO module?
Thanks in advance
Theo
I bought a RevPi connect+ and a RevPi DIO module. I would like to control my devices with a Python script.
Would it be possible to receive some examples of python programs: to control an actuator in modbus RTU ( write and read coil & write and read registers with some values) and to control I/O with the DIO module?
Thanks in advance
Theo
Re: Modbus RTU & RevPi DIO manage in Python script
Hi Theo, have a look at the RevPiModIO Python library. It makes it easy to access to the process image of the RevPi
Bit Mirror example
https://revolution.kunbus.de/forum/view ... rror#p6250
Documentation of the library
https://revolution.kunbus.de/forum/view ... 1026#p4198
Bit Mirror example
https://revolution.kunbus.de/forum/view ... rror#p6250
Documentation of the library
https://revolution.kunbus.de/forum/view ... 1026#p4198
Re: Modbus RTU & RevPi DIO manage in Python script
Hi Dirk, thanks for the reply and sorry for the delay.
I would like to retrieve information from a sensor with my RevPi connect and DIO module. I try to use the library RevPiModio2 but it doesn't work..
My DIO module is correctly configured, I check with the piTest -d
When I tried to swich on the LED on the Connect device, it doesn't work also. So; I am not sure how to use this library.. can you help me please?
My code :
import revpimodio2
import time
rpi = revpimodio2.RevPiModIO(autorefresh=True)
rpi.Connect.A3 = revpimodio2.GREEN
Error :
Traceback (most recent call last):
File "DIO.py", line 6, in <module>
rpi.Connect.A3 = revpimodio2.GREEN
AttributeError: 'RevPiModIO' object has no attribute 'Connect'
[/img][/img][/img]
I would like to retrieve information from a sensor with my RevPi connect and DIO module. I try to use the library RevPiModio2 but it doesn't work..
My DIO module is correctly configured, I check with the piTest -d
When I tried to swich on the LED on the Connect device, it doesn't work also. So; I am not sure how to use this library.. can you help me please?
My code :
import revpimodio2
import time
rpi = revpimodio2.RevPiModIO(autorefresh=True)
rpi.Connect.A3 = revpimodio2.GREEN
Error :
Traceback (most recent call last):
File "DIO.py", line 6, in <module>
rpi.Connect.A3 = revpimodio2.GREEN
AttributeError: 'RevPiModIO' object has no attribute 'Connect'
[/img][/img][/img]
- Attachments
-
- Capture.PNG (239.76 KiB) Viewed 10508 times
Re: Modbus RTU & RevPi DIO manage in Python script
Hi Theo,
the correct io would be For more details have a look into the documentation of revpimodio2: https://revpimodio.org/en/doc2/core/
Nicolai
the correct io would be
Code: Select all
rpi.core.a3
Nicolai
Re: Modbus RTU & RevPi DIO manage in Python script
Hi Nicolai! Thanks for your answer.
I will try that.
For you, what is the best to control my DIO module and to monitor the status of my inputs and outputs instantly? The RevPiLoad?
I will try that.
For you, what is the best to control my DIO module and to monitor the status of my inputs and outputs instantly? The RevPiLoad?
Re: Modbus RTU & RevPi DIO manage in Python script
Yes, RevPiLoad might be a good starting point. With the GUI it's possible to control the outputs and also upload a custom program which is written with revpimodio2. There are some cool examples on the website.
Nicolai
Nicolai
Re: Modbus RTU & RevPi DIO manage in Python script
Thank you! I try your recommandation but the LED doesn't light up
Then, I would like to read the status of my Input 1 without activate the Output 1. I read the examples on the website revpimodio with the mirror but I don't need that. Can you show me a little example to read the values of my input please ?
Code: Select all
import revpimodio2
import time
rpi = revpimodio2.RevPiModIO(autorefresh=True)
rpi.core.A3 = revpimodio2.GREEN