Go Down

Topic: digitalread() on ports 22 - 53 (Read 1 time) previous topic - next topic


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

Code: [Select]

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

void loop()

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?


Works fine on my Seeeduino mega1280 board. Perhaps you have a damaged pin 24? Does pin 24 work OK as an output pin?



ok pin 24 is damaged

thanks retrolefty

Go Up