Pages: 1 [2]   Go Down
Author Topic: None of the Analog Read Examples are working with 2560  (Read 3285 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds like your pot is hooked up wrong or something electrical is wrong with the Mega since you said the Uno works.

Did you try running the A0 pin straight to ground?  Just to see if the Mega will report back 0?  If that works take the wire out of A0 completely and see what the results are.  'Normally' you get fluctuating values.  If it comes back as 1023 there is a problem.   

I already did it, but it only shows 1023...
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26626
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Even grounded?
Sounds like a short somewhere, but if you ground it, I'd expect that to short the supply.
Can you post your actual code, not the stuff you posted in reply #2.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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

Even grounded?
Sounds like a short somewhere, but if you ground it, I'd expect that to short the supply.
Can you post your actual code, not the stuff you posted in reply #2.

But i am using only the examples that come with arduino ide, the only thing that i change is the port....
Logged

0
Offline Offline
Shannon Member
****
Karma: 221
Posts: 12710
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The only way to guarantee reproducing a problem is to run the exact same sketch on the exact same hardware - otherwise you could chase red-herrings for hours.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Jr. Member
**
Karma: 2
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I already did it, but it only shows 1023...

So you are saying that even running a wire from A0 to ground you are getting 1023?  Are you connecting a wire from A0 to the GND port on the Mega directly?

If so something is wrong.  Even if there is a short running it directly to ground should bring it down.   
Is your Mega sitting on top of a metal table or something?  There are no shields installed right?



Logged

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

I already did it, but it only shows 1023...

So you are saying that even running a wire from A0 to ground you are getting 1023?  Are you connecting a wire from A0 to the GND port on the Mega directly?

If so something is wrong.  Even if there is a short running it directly to ground should bring it down.  
Is your Mega sitting on top of a metal table or something?  There are no shields installed right?



Yes i connected a wire from A0 to GND directly too, and tried the ReadAnalogVoltage program, but it shows only 5v. And i havent tried the 54 digital pins , only the pwn outputs, but i think the problem is with the ATMega2560 ;/. And it doesn't have any shield on it, and i am using it on wood table.
« Last Edit: October 05, 2012, 08:11:05 am by rgPaiva » Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Yes i connected a wire from A0 to GND directly too, and tried the ReadAnalogVoltage program, but it shows only 5v. And i havent tried the 54 digital pins , only the pwn outputs, but i think the problem is with the ATMega2560 ;/. And it doesn't have any shield on it, and i am using it on wood table.

What about the other analog pins?  Did you try A1-A5? 

Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26626
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And i havent tried the 54 digital pins , only the pwn outputs
This phrase worries me.
What have the PWM outputs got to do with the problem here?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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

Quote
And i havent tried the 54 digital pins , only the pwn outputs
This phrase worries me.
What have the PWM outputs got to do with the problem here?

Sorry it was the digital 9 next to the pwm. I used the digital pin 9 to the example AnalogInOutSerial, but the led got the 5v all the time.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 653
Posts: 50881
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Sorry it was the digital 9 next to the pwm. I used the digital pin 9 to the example AnalogInOutSerial, but the led got the 5v all the time.
You're on the wrong side of the board. The PWM pins are output only. Reading an analog value is done on the analog pins. The ones on the other side of the board.
Logged

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

Quote
Sorry it was the digital 9 next to the pwm. I used the digital pin 9 to the example AnalogInOutSerial, but the led got the 5v all the time.
You're on the wrong side of the board. The PWM pins are output only. Reading an analog value is done on the analog pins. The ones on the other side of the board.

Yes... and thats why i used the AnalogInOutSerial example that come with arduino 1.0 ide. Using the led at port 9...
« Last Edit: October 05, 2012, 12:33:36 pm by rgPaiva » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 653
Posts: 50881
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Using the led at port 9...
What does that have to do with the failure to read proper data from an analog pin that you hadn't connected the pot to?
Logged

Pages: 1 [2]   Go Up
Jump to: