Quote:
Originally Posted by gtkid2002
Although if I removed any of the inputs the led just stayed lit, which was a little irritating, but whatever.
|
Huh... The LED switched off on mine. Odd. Were you testing more than one input at a time? The LED comes on when any one of the inputs is grounded; It won't turn off until ground has been removed from all of them.
Quote:
Originally Posted by gtkid2002
I see why you both are using your own custom codes. Trying to decipher the code is confusing as hell, even if I don't know what i'm doing.
|
I think the issue with the VSS and buttons is the pin numbering differences between the two board designs. The VSS and buttons are routed to analog pins which, when used as digital I/O pins, have pin number designations that depend on the board design. As such, the program needs to be tweaked to look at the proper pins.
Thankfully, well written code is easily adaptable. If you open up mpguino.pde and scroll down a little, you'll see a bunch of #defines. The first important one you'll come across is:
Code:
#define VSSPin 14 //analog 0
These defines are simply place holders... The above line lets a programmer type "VSSPin" where some bit of programming would expect a number, such as a pin number. The point being that changing the value (14) in the #define to some other number would then substitute that new value in to any function in the program that would make use of the VSSPin, so long as "VSSPin" is used where the pin number should be.
As I outlined above, the mega's analog pins start at pin 54, so that should be:
Code:
#define VSSPin 54 //mega analog 0
Scrolling down again, you'll see the pin designations for the LCD display, followed by:
Code:
#define lbuttonPin 17 // Left Button, on analog 3,
#define mbuttonPin 18 // Middle Button, on analog 4
#define rbuttonPin 19 // Right Button, on analog 5
Which should be:
Code:
#define lbuttonPin 57 // Left Button, on mega's analog 3,
#define mbuttonPin 58 // Middle Button, on mega's analog 4
#define rbuttonPin 59 // Right Button, on mega's analog 5
Give that a try.