Ok i wrote this bit of code and all i get for my serial output is either C or G when i move the pins high and low. If somebody could give me an idea of what i need to fix it would be appreciated.
int buttonOne = 3;
int buttonTwo = 4;
int buttonThree = 5;
int buttonFour = 6;
int ledOne = 7;
int ledTwo = 8;
int ledThree = 9;
// setup initializes serial and the button pin
void setup()
{
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
pinMode(ledOne, OUTPUT);
pinMode(ledTwo, OUTPUT);
pinMode(ledThree, OUTPUT);
pinMode(buttonOne, INPUT);
pinMode(buttonTwo, INPUT);
pinMode(buttonThree, INPUT);
}
// loop checks the button pin each time,
// and will send serial if it is pressed
void loop()
{
if (digitalRead(buttonOne) == LOW, digitalRead(buttonTwo) == LOW, digitalRead(buttonThree) == LOW, digitalRead(buttonFour) == LOW)
Serial.print("C"); // C
else if (digitalRead(buttonOne) == HIGH, digitalRead(buttonTwo) == HIGH, digitalRead(buttonThree) == HIGH, digitalRead(buttonFour) == LOW)
Serial.print("C#"); // C#
else if (digitalRead(buttonOne) == HIGH, digitalRead(buttonTwo) == LOW, digitalRead(buttonThree) == HIGH, digitalRead(buttonFour) == LOW)
Serial.print("D"); // D
else if (digitalRead(buttonOne) == LOW, digitalRead(buttonTwo) == HIGH, digitalRead(buttonThree) == HIGH, digitalRead(buttonFour) == LOW)
Serial.print("D#"); // D#
else if (digitalRead(buttonOne) == HIGH, digitalRead(buttonTwo) == HIGH, digitalRead(buttonThree) == LOW, digitalRead(buttonFour) == LOW)
Serial.print("E"); // E
else if (digitalRead(buttonOne) == HIGH, digitalRead(buttonTwo) == LOW, digitalRead(buttonThree) == LOW, digitalRead(buttonFour) == LOW)
Serial.print("F"); // F
else if (digitalRead(buttonOne) == LOW, digitalRead(buttonTwo) == HIGH, digitalRead(buttonThree) == LOW, digitalRead(buttonFour) == LOW)
Serial.print("F#"); // F#
else if (digitalRead(buttonOne) == HIGH, digitalRead(buttonTwo) == LOW, digitalRead(buttonThree) == HIGH, digitalRead(buttonFour) == HIGH)
Serial.print("G"); // G
else if (digitalRead(buttonOne) == LOW, digitalRead(buttonTwo) == HIGH, digitalRead(buttonThree) == HIGH, digitalRead(buttonFour) == HIGH)
Serial.print("G#"); // G#
else if (digitalRead(buttonOne) == HIGH, digitalRead(buttonTwo) == HIGH, digitalRead(buttonThree) == LOW, digitalRead(buttonFour) == HIGH)
Serial.print("A"); // A
else if (digitalRead(buttonOne) == HIGH, digitalRead(buttonTwo) == LOW, digitalRead(buttonThree) == LOW, digitalRead(buttonFour) == HIGH)
Serial.print("A#"); // A#
else if (digitalRead(buttonOne) == LOW, digitalRead(buttonTwo) == HIGH, digitalRead(buttonThree) == LOW, digitalRead(buttonFour) == HIGH)
Serial.print("B"); // B
else if (digitalRead(buttonOne) == LOW, digitalRead(buttonTwo) == LOW, digitalRead(buttonThree) == LOW, digitalRead(buttonFour) == HIGH)
Serial.print("CHIGH"); // C
else if (digitalRead(buttonOne) == HIGH, digitalRead(buttonTwo) == HIGH, digitalRead(buttonThree) == HIGH, digitalRead(buttonFour) == HIGH)
Serial.print("C#GHIGH"); // C#
delay(1000);
}