Page 1 of 1
Input/Output Revolution Pi Connect 4
Posted: 04 Nov 2024, 22:40
by DanielArmendariz
Hello!
I have a Revolution Pi Connect 4 and I want use de input for conected a sensor, I try it but the RevPi dont detect the signal(24VDC)
Re: Input/Output Revolution Pi Connect 4
Posted: 05 Nov 2024, 08:52
by dirk
Hi great question
A) Create a PiCtory configuration
https://revolutionpi.com/en/tutorials/was-ist-pictory-2
- Drag RevPi Connect 4 module onto virtual DIN rail
- File → Save as start configuration
- Tools → Reset Driver
B) Test Configuration
Code: Select all
pi@RevPi123834:~$ piTest -d
Found 1 devices:
Address: 0 module type: 136 (0x88) RevPi Connect 4 V1.0
Module is present
input offset: 0 length: 6
output offset: 6 length: 7
C) Connect digital input of X2 plug
https://revolutionpi.com/en/tutorials/r ... -connect-4
D) Read status byte, bit 6 contains the status of the digital input
Code: Select all
pi@RevPi123834:~$ piTest -r RevPiStatus
1 Byte-Value of RevPiStatus: 1 dez (=01 hex)
1 Byte-Value of RevPiStatus: 65 dez (=41 hex)
pi@RevPi123834:~$ piTest -v RevPiStatus
variable name: RevPiStatus
offset: 0
length: 8
bit: 0
pi@RevPi123834:~$ piTest -g 0,6
Get bit 6 at offset 0. Value 1
pi@RevPi123834:~$ piTest -q -g 0,6
1
https://revolutionpi.com/en/tutorials/s ... pi-connect
Alternatively, you can do it
in the Python way using these commands:
Code: Select all
# Connect4DigitalInput.py
import revpimodio2
rpi = revpimodio2.RevPiModIO(autorefresh=True)
if(rpi.io.RevPiStatus.value & (1<<6)):
print("High")
else:
print("Low")
Execute it
Code: Select all
pi@RevPi123834:~$ python3 Connect4DigitalInput.py
Low
pi@RevPi123834:~$ python3 Connect4DigitalInput.py
High