Offline
Newbie
Karma: 0
Posts: 6
|
 |
« on: June 25, 2012, 09:32:21 pm » |
I must be an idiot. I just picked up a Mega 2560 for a project I've been piecing together that requires comm with a number of other devices. Anyway, sketches that work just fine on my Uno, don't work on the Mega. Everything seems to compile and upload just splendidly, but then things get odd. Serial comm seems to be working nominally, but I can't get any digital, PWM, or analog ports to work - specifically, I can't even get a single LED to light up (other than one plugged in to pin 13 - but even that I can't control - it only lights up upon reset and serial comm).
Any ideas here? I must be missing something that's terribly obvious.
|
|
|
|
|
Logged
|
|
|
|
|
Massachusetts, USA
Offline
Tesla Member
Karma: 97
Posts: 6376
|
 |
« Reply #1 on: June 25, 2012, 09:57:38 pm » |
Are you doing anything strange like direct port access?
Does the Blink example not blink the on-board LED?
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX
Offline
Faraday Member
Karma: 41
Posts: 5174
CMiYC
|
 |
« Reply #2 on: June 25, 2012, 10:33:24 pm » |
Any ideas here? I must be missing something that's terribly obvious. I'm placing bets it is around line 12 or 47 of the code you didn't post.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #3 on: June 25, 2012, 10:39:12 pm » |
I haven't done any port manipulation; only digital and analog write commands. If I remember correctly (I don't have the board available at the moment to confirm), the on-board LED did work for at least some of the test cases I tried out with it. I will test again tomorrow, though.
I actually tried the same sketch on two separate Megas, both with failing results, followed by success on an Uno... If nothing else, it makes me fairly confident that it's something that I'm doing wrong - not a hardware issue as I had initially suspected.
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX
Offline
Faraday Member
Karma: 41
Posts: 5174
CMiYC
|
 |
« Reply #4 on: June 25, 2012, 10:48:09 pm » |
Okay. In that case I'm suspecting it is lines 6 or 22 of the code you still haven't posted.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #5 on: June 25, 2012, 10:48:40 pm » |
I'm placing bets it is around line 12 or 47 of the code you didn't post. [/quote] Clever...  Yeah, I figured that would come up, but I don't think there were even 12 lines of code in total in the digitalWrite or analogWrite sketches I tried (corresponding to the proper pin types).
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX
Offline
Faraday Member
Karma: 41
Posts: 5174
CMiYC
|
 |
« Reply #6 on: June 25, 2012, 10:51:33 pm » |
I'm not use to troubleshooting nonexistent code so well. Obviously it is line 5. Hard to believe you missed it!
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #7 on: June 25, 2012, 10:52:24 pm » |
I'm sure there will be yet another comment on not posting code here, but is there a distinction beyond calling different pins and tx/rx ports on an Uno and Mega? If not, shouldn't identical code working properly on one board and not another be an indication that the problem is elsewhere?
|
|
|
|
|
Logged
|
|
|
|
|
2nd star on the right
Offline
Jr. Member
Karma: 0
Posts: 82
Everything I am is classified under the official secreats act!
|
 |
« Reply #8 on: June 26, 2012, 01:09:26 am » |
You did install the Mega's drivers and set the board preference to the correct mega did you? I'm using the mega adk that uses a separate driver config!
|
|
|
|
|
Logged
|
Sorry for the noobish post but my knowledge is 10 years out of date!
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #9 on: June 26, 2012, 06:18:17 am » |
To be fair, here is an example (I just tried running it again). This is the example code provided with the IDE under basic > blink.
/* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */
void setup() { // initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards: pinMode(13, OUTPUT); }
void loop() { digitalWrite(13, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(13, LOW); // set the LED off delay(1000); // wait for a second }
I do know that I have the proper board selected (Mega 2560), but I'm not sure about drivers... do you mean bootloader? If so, that's something I haven't yet ventured into, but I had assumed it would come preloaded with the correct bootloader. Or maybe there are some drivers I'm not familiar with?
|
|
|
|
|
Logged
|
|
|
|
|
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 7
Posts: 3532
|
 |
« Reply #10 on: June 27, 2012, 07:36:28 am » |
Hmm, if blink isn't working there's definitely some issue. What happens when you try to upload? What operating system are you on? Which version of the Arduino software are you using?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #11 on: June 27, 2012, 09:18:46 pm » |
Mellis-
Uploading seems to work as expected and completes without throwing any errors. I'm working on Lion OSX, using Arduino 1.0 at the moment (I'll need to update to 1.0.1 it seems), but I've also tried with 0022. I'll update to 1.0.1 here and see if there's any magic there.
|
|
|
|
|
Logged
|
|
|
|
|
|