I am experiencing something very strange. When I perform an anologRead and a digitalRead anywhere in the program, it simply ignores that the digitalRead ever happened and continues on. If I comment out the analogRead, the button works like normal. I proved that this is only happening on my SainSmart MEGA2560 and NOT on the UNO.
analogRead works if there is no call to digitalRead and vice versa. If both are called, it ignores the digitalRead. Sorry, I should have explained better.
Was the Mega immersed in water or wet steam? Was it powered up at the time?
It was in a plant box with a humidifier blowing into it. Yes it was powered up.
analogRead works if there is no call to digitalRead and vice versa.
That doesn't make a lot of sense maybe it is the fact you are not using a real arduino?
On a real arduino there is no connection between the analogue input pins and the digital pin 5.
No matter what you do it will not allow any combination of digitalRead and analogRead, if you do use both, it prefers the analog . I adjusted the code of the main project to read the buttons via analogRead and got it working. Any ideas how the water could do that and no other noticeable problems?
Any ideas how the water could do that and no other noticeable problems?
No, and that is why I would suggest that is not your problem.
So:-
Post the minimal sketch that shows the problem and say what you see it do.
Post the schematic of how you have wired things up and also include a photograph of your setup.