I have raspihat Rly10 and Di16. Rly10 for outputs and Di16 for inputs. I can trigger the Rly10 but cant get a reading from photo sensor in Di16. I used a shell command to trigger outputs. I would like to know how can i get inputs to read on web interface. Can anyone help here please. Website for raspihats----- https://raspihats.com/
-
Raspihat
-
What means photo sensor? An analog sensor?
This will not work on a digital input. -
it does work on python and get value of 0 and when i switch light on i get value of 1. Also i did get state print to screen true and false.
from raspihats.i2c_hats import Di16
from time import sleepdi16 = Di16(0x40)
while True:
state = di16.di.channels[0]
print(state) -
from your description: its just guessing…
do you have both hats stacked on each other? they work with i2c? do they have different addresses? do they work, if you only stack one hat at a time on your raspberry? -
Yes i do have hats stacked. Rly10 is on 0x50 and Di16 on 0x40. The do work with i2c (/dev/i2c-1) Both are working. Here is code in python for Rly10.
om raspihats.i2c_hats import Rly10
from time import sleepb = Rly10(0x50)
def trigger():
b.dq.channels[0] = True
try:
trigger()except KeyboardInterrupt:
print (“0”)I use a buttonshell to execute files. of Rly10
rom raspihats.i2c_hats import Rly10
from time import sleepb = Rly10(0x50)
def trigger():
b.dq.channels[0] = False
try:
trigger()except KeyboardInterrupt:
print (“Quit”)So when i switch it on i run via python
from raspihats.i2c_hats import Di16
from time import sleepdi16 = Di16(0x40)
while True:
state = di16.di.channels[0]
print(state)so state is true and if i switch off it goes to false.
What i do need is to show me that switch is on (output) on web page (input) that part i dont get right
-
as this is a pimatic forum: maybe https://pimatic.org/plugins/pimatic-shell-execute/ could help you. little scripts for each functionality that output the results and then can be integrated into pimatic
-
Ill try it but dont think it will work via shell exicute. will let you know thank you
-
why not? if your call looks something like ‘python my_script.py input=1’ (i don’t know right know, how to pass parameters) and your script just outputs exactly the one value for input channel 1 - why shouldn’t it work?