How does this code look? Its supposed to run multiple PIEZO's and send the data to my serial program.
//###############################################
//VARIABLES
//###############################################
const int numOfAnalogs = 3; //Change the integer to incorporate the amount of analog inputs you use.
int midiChannel = 9;
int outPin = 13; // the number of the output pin, main LED
int analogSmooth = 2; // Amount of change needed to send control change...
int lastAnalogArray[numOfAnalogs];
int reading[numOfAnalogs];
//###############################################
//END OF VARIABLES
//###############################################
void setup()
{
Serial.begin(9600);
}
void loop()
{
for (int i = 0; i<numOfAnalogs; i++) {
reading = analogRead(i)/8; // change 0-1024 into 0-127
if (abs(reading_-lastAnalogArray*) > analogSmooth) {_
lastAnalogArray _= reading;
sendToSerial(i,reading);
}
}
}
void sendToSerial(byte pin, byte velocity) {
digitalWrite(outPin,HIGH); // indicate we're sending MIDI data*
* Serial.print(pin, BYTE);
Serial.print(velocity, BYTE);
digitalWrite(outPin,LOW); // indicate we're sending MIDI data*
}_