Now, there shouldn't be anything unusal with this right? It's just another guards van which was used on express freight trains back in the day. Well the ones I have do have lovely red marker lights at the rear so there is a built in circuit inside and when this van hits the detector, it would announce the following station past the one we are approaching!
How to resolve this issue?
I thought for sometime. The options I had were
1. Remove the circuit inside the vans - which I was reluctant to do as they do look very nice running during the dark.
2. Increase the delay function from 20 secs to say 40 secs in the Arduino Code
Well I did just that - option 2- but the arduino would then get "lost" for some reason and would not detect the next time round!
So I was back to square 1.
Then it hit me, instead of using the built in delay function, why not call another function called killtime() and in it program a While Loop and delay another x seconds.
I gave this a try and lo and behold this worked! I was pretty pleased with myself for working this one out. So I call killtime(x) where x is the number of seconds I want to delay.
It works like a bought one!
Another way would be to ignore another detector reading within n seconds of the first one.
ReplyDeletealready had that in the code and tried to extend it by another 40 seconds but the arduino goes off to la-la land
Delete