I'm using ethernet shield to send Email alerts(using hostmonster host server), based on certain sensor readings. Specifically, an IR distance sensor telling me when garage door is open vs. closed, and I want alert every time the door changes state, ie. from open to closed and visa versa.
The sensor data and my algorithm are fine, tested using LED's in place of Email alerts for OPEN and for CLOSED.
The php files(one which sends alert OPEN and other CLOSED) I have on the hostmonster work fine, as I test them "manually" but invoking them from browser, and I receive the alerts on my Blackberry.
Problem: when I let the Arduino system run, the alert comes the first time the garage door is OPEN, but I sometimes don't get the CLOSED alert, or it comes hours or even days late. I start with door closed, and the variable representing the state is initialized as 'C' for closed.
Now, I get the same type problem when I start with door open and initialize the state as 'O' for open: thus, I get the first alert when door closes but not the alert when it later opens.
So, the converse alert is unreliable.
Assuming for the moment that the code is OK (remember, I tested algorithm using LED's, a RED which blinks twice for change of state from closed to open, and a GREEN one which blinks twice when state changes from open to closed) could there be a problem between Ethernet Shield, router and hostmonster?