Hi All,
Just wondering if this is sound approach
I have three cams performing analyses on moving objects ( around 2 or 3 per second).
(so no time left to do heavy stuff …)
One Arduino MKR with an ethernetshield is handling the results for each object.
Each cam send ok/notok info…
So all cams are a kind of master, the mkr is slave…
Since i heard I2c is not very suitable i turned to a simplistic approach a bit sonar like.
On the Cams I just use one pin ( grounds are shared ) and then two def’s that are called for each outcome
def ok():
i=0
pin1.high()
pyb.delay(10)
pin1.low()
pyb.delay(3)
def notok():
i=0
pin1.high()
pyb.delay(25)
pin1.low()
pyb.delay(3)
On the arduino i read three digital ports ( one for each cam )
Loop {
int CamOneValue = digitalRead(1);
// does the pin on cam 1 goes high
if (CamOneValue!=0 && cam1sig == 0){
cam1sig=millis();
}
// is it down again ??
if (CamOneValue ==0 && cam1sig > 0 ){
cam1dur = millis()- cam1sig; // how log was it up ?
cam1sig = 0
// so it was ok
if (cam1dur < 11 ) {
// do something with OK
}
// it a fail
if (cam1dur > 11 ) {
// do something with Fault
}
}
// repeat above for the other two cams, don't use delays
}
Seems to work perfectly with just very little deviations sometimes 9 or 8 instead of ten, but accurate enough for me…
Maybe usefull to some or it this a ‘not done’
Regards…