Pages: [1]   Go Down
Author Topic: Arduino Mega 2560 pin staying HIGH [solved]  (Read 923 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just got this from ebay:
Code:
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:
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:

« Last Edit: May 27, 2012, 03:42:39 pm by Nick Gammon » Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8531
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
PIN 22 and 23 are staying HIGH
What about the other pins?

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

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

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

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8531
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

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

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

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8531
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: [1]   Go Up
Jump to: