There are only 3 momentary switches connected to pins 0,1,2 and gnd. The led is connected to pin 13 and gnd. The led on both the board and pin 13 work, the brightness is not an issue, I'm trying to get it to work first. The code you posted in #17 won't compile because of the error 'usbMidi' was not declared in this scope.
This code works for one button
This code works for one button
Code:
/*
* Programmed by: Md. Mehrab Haque
* Dhaka, Bangladesh.
* Phone: +8801795415378 */
int stateNow = 0;
int stateBefore = 0;
int i = 0;
int j = 0;
void setup() {
pinMode (0, INPUT);
pinMode (13, OUTPUT);
}
void loop() {
stateNow = digitalRead(0);
if (stateNow != stateBefore) {
if (stateNow==HIGH and i==0) {
digitalWrite (13, HIGH);
j=1;
}
else if (stateNow==LOW and j==1) {
i=1;
}
else if (stateNow==HIGH and i==1) {
digitalWrite (13, LOW);
j=0;
}
else if (stateNow==LOW and j==0) {
i=0;
}
}
stateBefore=stateNow;
}