Serial.print not working.

I have a sketch that working last week. However, it is not working now. My Arduino Mega is connected to a series of piezo’s and when they are triggered should send data through the serial connection. Unfortunately, when I open the serial monitor to test, no data is coming in.

Code below:

const int NUM_OF_KEYS = 6;
const int threshold = 5;
const int triggerSensor[NUM_OF_KEYS] = {A0, A1, A2, A3, A4, A5};
int triggerVal[NUM_OF_KEYS] = {0};
const int NOTE_LENGTH = 50;
bool noteIsOn[NUM_OF_KEYS] = {false};
void setup() {
  Serial.begin(9600);
}
void loop() {
{
    //repeat the below code for each anaolog input/piezo sensor
    for (int count; count < NUM_OF_KEYS; count++)
    {
        //read the piezo value
        triggerVal[count] = analogRead(triggerSensor[count]);

        if (triggerVal[count] > threshold && noteIsOn[count] == false);
        {
          Serial.println(A0);
          Serial.println(A1);
          Serial.println(A2);
          Serial.println(A3);
          Serial.println(A4);
          Serial.println(A5); 
        }
delay(1);
}
}
}

Any suggestions or assistance would be greatly appreciated.

Disconnect everything.

Reboot your PC.

Download the Blink sketch to your Mega just to make sure the Mega is still okay.

spranieri:
I have a sketch that working last week. However, it is not working now. My Arduino Mega is connected to a series of piezo's and when they are triggered should send data through the serial connection. Unfortunately, when I open the serial monitor to test, no data is coming in.

Any suggestions or assistance would be greatly appreciated.

Before

if (triggerVal[count] > threshold && noteIsOn[count] == false);

put this to determine if the if() statement is even true:

Serial.println(triggerVal[count]);
Serial.println(noteIsOn[count]);
void setup() 
{
   Serial.begin(9600);
   Serial.println("serial is working");
}

If that prints, serial print is working. If not the problem is the code, wiring or, perhaps, a baud rate mismatch.