I am using a Knock Off Pro Micro. When I send 5 volts to pin A0 of the Pro Micro without supplying 5 volts to raw, the Pro Micro activates and runs the following uploaded program.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
pinMode(A0, INPUT);
}
// the loop function runs over and over again forever
void loop() {
if(A0, HIGH)
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(2000);
}// wait for a second
else
{
digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a second
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off by making the voltage LOW
delay(2000);
}
}
Why does the program run when 5 volts is supplied to A0 with 0 volts to raw?
Is there a way to prevent A0 from powering the ProMicro?
I am trying to send different values to an output pin depending on which input pins are high and low.
Any help would be much appreciated.