Hi guys
I have a problem with digitalread() on arduino mega 2560
I'm using pin 24 as input and pin 22 and 23 as outputs
pin 22 is high and pin 23 is low
digitalread(24) should return 1 if I connect pin 22 and 24 with a wire but it always returns 0
here is my code
void setup()
{
// Input Output Init
pinMode(24,INPUT); // sets the digital pin as input
pinMode(22,OUTPUT); // sets the digital pin as output
pinMode(23,OUTPUT); // sets the digital pin as output
digitalWrite(22,HIGH); // Set pin 22 high
digitalWrite(23,LOW); // Set pin 23 low
Serial.begin(9600);
delay(200);
Serial.println("ready");
}
void loop()
{
Serial.println(digitalRead(24));
delay(500);
}
it works fine if i use one of the pwm pins as input but i dont want to waste them for a simple bridge
so is there a way to get a HIGH with digitalread() on pin 24?