Sketch for Rain Sensor

No change!

I'll try your modified code, thanks.

I did think about writing the ASCOM driver myself and there are templates in Visual Studio but that's a whole new learning curve and I'm an astronomer not a programmer. I would rather be astronomying!

Thanks for your patience and tenacity.

Regards

Graeme

Well I tried it again using your modified code and the thing works perfectly! You are the man! With the switch open, the NINA Safety Monitor Is safe has a steady tick next to it and the Arduino D13 LED remains on. When the switch is closed, the LED turns off and the tick turns into a red X.

I understand the theory of INPUT_PULLUP but I haven't used it in the limited number of projects I've built. I'll read up on it to gain a thorough understanding.

I'll mark this thread as solution provided and then some!

I'm grateful for your help.

Thanks

Regards

Graeme

Well that's very good news. :grinning:

However, I don't understand why the external pull up of 10K you showed in your circuit diagram did not work equivalently to the INPUT_PULLUP mode. Perhaps there was a bad wire or connection.

This new code also removed some delays from the reading routine. Do you know how frequently the NINA/ASCOM code sends the "S#" message to the Arduino?

Perhaps some output buffer was getting filled up, or perhaps the reply was not coming back within a specified window, and one of these factors caused the program to reset the status.

Yes, I think the initial problem was having the IDE running at the same time as NINA caused a clash with Com 4, then the delays that were put in for fault finding were causing some sort of time out.

No worries. It's fixed now and I learnt a lot!