Since this is my first post to this forum, please be indulgent.
Devices being used
2 transistors/relays (i.e. digital pin 2 and 3) to control one motor and 2 limit switches (digital pin 4 and 5) to stop the motor when the roof is fully open or closed (see attached schematic).
When I power on the arduino board and/or when I connect to it, the observatory roof is normally closed, therefore, one of the limit switch is closed and the associated digital pin (5) should read HIGH. However, at power on or after Arduino reset, the pin state allways show LOW. My vb.net code therefore allways report “WARNING: Unknown Status of Roof” (as per my code) because both pin 4 and 5 read LOW (even though, I have one switch closed).
The only way I found to make sure to have my code read the pin state as High, is to use “firmata_test.exe” to read all of the Arduino pins state and force digital pin 4 and 5 to output mode and then back to input mode. As soon as I switch these pins to input mode, they start reading high. I then, close “firmata_test.exe” and fire up my application where the pin states are ok. After that, my application will work ok until I shut down the power to the Arduino.
Does anyone have an idea of why this is happening and how I can resolve this?
easyobs.txt (4.16 KB)