PaulS:
digitalWrite(14 + DoorBellPin, HIGH); // set pullup on the analog pinBut, you are not using the analog pin as a digital pin, so why are you doing this?
Good question. I am blindly following Roo Reynold's code. It's what he did, and it has worked well up to now. I'll take this bit out and see what happens.
PaulS:
if (DoorBellPinVal < 100) {
if (currentMillis-DoorBellValTriggeredMillis > debounce) // And if we're not within debounce time
{
DoorBellTriggered = 1;
DoorBellValTriggeredMillis = currentMillis;
}
}
And, if DoorBellPinVal is > 100, what happens? If the interval is less than debounce, what happens?
Nothing happens and nothing is supposed to happen. Do I need to cater for these situations if I don't want anything to change/happen?
PaulS:
The else block to move the servo back is attached to the if(Button1State) statement. Again, I'd like to encourage you to use more meaningful names. I don't see where Button1State is assigned a value before it is used, nor do I know what it means. So, I can't tell if the else statement is in the right place, or not.
I'll look at Button1State to see if I can name it better and if it's necessary at all.
PaulS:
The mix of styles, with some { on new lines and some on the line with the if statement, and the random indentation do not help with seeing the structure of the program. Pick one style (I prefer the new line style myself) and stick with it. Use Tools + Auto format again (and again and again, if necessary as you revise the code.
BIT sad about this, because I've been really working at my indentation since your last chiding. I'll try to do better.