Pages: [1]   Go Down
Author Topic: digitalread() on ports 22 - 53  (Read 759 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

 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?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok pin 24 is damaged

thanks retrolefty
Logged

Pages: [1]   Go Up
Jump to: