Go Down

Topic: Arduino Mega 2560 pin staying HIGH [solved] (Read 977 times) previous topic - next topic

MrKovacic

May 27, 2012, 04:15 am Last Edit: May 27, 2012, 10:42 pm by Nick Gammon Reason: 1
I just got this from ebay:
Code: [Select]

Arduino-Compatible Mega 2560

comes with

- ATmega2560--16AU micro controller (MCU)
- ATmega8U2-MU USB-to-Serial controller
?

Key Features:

ATmega2560 Microcontroller
Bootloader installed, ready for sketches (programs) uploading from Arduino software (IDE)
Flash Memory 256 KB
EEPROM 4 KB
Free USB Cable Included
Specifications:

Microcontroller ATmega2560
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 54 (of which 14 provide PWM output)
Analog Input Pins 16
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 256 KB of which 8 KB used by bootloader
SRAM 8 KB
EEPROM 4 KB
Clock Speed 16 MHz


The problem is, it is having trouble executing simple blink command, here is what i uploaded into it:
Code: [Select]

void setup() {
 
 pinMode(22, OUTPUT);
 pinMode(23, OUTPUT);
 pinMode(24, OUTPUT);
 pinMode(25, OUTPUT);
 pinMode(26, OUTPUT);
 pinMode(27, OUTPUT);
 pinMode(28, OUTPUT);
 
}
void loop(){
 
 digitalWrite(22, HIGH);
 delay(1000);
 digitalWrite(22, LOW);
 delay(1000);
 digitalWrite(23, HIGH);
 delay(1000);
 digitalWrite(23, LOW);
 delay(1000);
 digitalWrite(24, HIGH);
 delay(1000);
 digitalWrite(24, LOW);
 delay(1000);
 digitalWrite(25, HIGH);
 delay(1000);
 digitalWrite(25, LOW);
 delay(1000);
 digitalWrite(26, HIGH);
 delay(1000);
 digitalWrite(26, LOW);
 delay(1000);
 digitalWrite(27, HIGH);
 delay(1000);
 digitalWrite(27, LOW);
 delay(1000);
 digitalWrite(28, HIGH);
 delay(1000);
 digitalWrite(28, LOW);
 delay(1000);
}


this is just to test the pins, because PIN 22 and 23 are staying HIGH, even though they were told to go LOW by the program. Did I buy a crappy/broken board?

Actual image:


Graynomad

Quote
PIN 22 and 23 are staying HIGH

What about the other pins?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

MrKovacic

I tested about 20 pins, and just those 2 are acting up. I have a project coming up that is going to use a total of 30 pins atleast (for output only)

Graynomad

AFAIK those two pins have no other functions that may be getting in the way. Do you have anything different connected to those two pins? If not maybe the board is faulty.

Workaround: Use two other pins :)

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

MrKovacic

Solved my own problem. If you look at the pic of the board, I put the LED pos wires in the top 2 pinholes of the right most 2 columns. Those rails are constant HIGH. PIN 22 and 23 start at the second row down.

We can scratch this off as PICNIA... (Problem In Chair, Not In Arduino) aka Noob mistake.

Thanks!!!

Graynomad

Rob Gray aka the GRAYnomad www.robgray.com

Go Up