I have made a remote control for a scoreboard, based on previous ones, but due to oversight, and burning the midnight oil, I forgot to fit my normal standby button ( to switch off all the displays when not in use )
I was supposed to get this unit out today, and don't have time to add a pushbutton and reprint the decal ( which needs a strip down of 16 bcd switches )
@ Crossroads , finally I have made a sort of FTDI cable from a $4 usb adaptor, which is plugged in at the back to the receiver on the left, but you can see a socket dangling from the remote too - what a Godsend , I wish you had mentioned it before
Right, so what I have been trying to do, is to have the receiver/display unit go into standby if the update button is held for over a second.
The remote repeatedly transmits, but on the receive side, there is a gap between each receive.
if (vw_get_message(buf, &buflen)) // Non-blocking
I know there must be a way to set a timer on the first receive, and somehow make "standby" go high if there is not a second between them, but I just cant see it ( 16 hours sleep since last weekend ! )
Any suggestions ?
Here's the code with debris commented out from what I have tried :-
Thanks Crossroads, I tried a few variations on that , but the trouble is that if ((newTime - oldTime) >=1000) will always be when they update the score, perhaps a minute later.
Perhaps I should set a targetMillis as millis + 1000 when the first signal arrives, and set a flag as "counting = 1 "
While counting is hi, I can count number of signals received , and if > x enables standby and resets counting. ??
I'm sure you'll get it worked out John.
Maybe check the data coming in also, if the same as existing data then go into standby.
Not really sure what standby does for you, as you are not powering down or anything.
I think I am getting there, I have 13 jobs to get out and I am getting confused which is which
the standby function in the showtime routine blanks all the displays, I like the schools to leave it in standby as in winter the slight warmth of the power supply keep moisture at bay.
It also saves them walking accross the field to switch on or off !
When the first data comes in, it starts a two second timer, and a loop counter.
At the end of the 2 secs, it sees how many loops has been, and if its more than 6, it sets the standby function.
One problem was that after blanking, it came back on again , and that was because there was still one lot of data in the VW buffer, so I made it ignore the first data if in standby.
It means they press update for over 2 secs to switch off, and press update twice to switch back on. ( it has to do , I had to get it out quick )
The code is not pretty, and is like picking your nose with your thumb ! but it works !