hi dear people,
first question as arduino newbee :
i want to use arduino with 4 piezos to trigger sounds via midi in ableton live.
the soldering part for the piezos & midi out is finished
( using >>> http://itp.nyu.edu/physcomp/Labs/MIDIOutput ),
but i desperately need some help with the coding part ,
cause i got ? errormessages when compiling/verifying till now . ( f.e error expected ',' or '...' before numeric constant )
anyone willing to help ???????
below 's the code i have till now ( only for 1 piëzo till now ) :
thanks !!!
// 4 piezos to midi
int ledPin = 13 // Led connected to digital pin 13
int piezo1 = 0 // Piezo 1 connected to analog 0
byte val = 0 // variable to store the value read from the sensor pin
int statePin = LOW; // variable used to store the last LED status , to toglle the light
int THRESHOLD = 100; // threshold value to decide when the detected sound is a knock or not
void setup()
{
pinMode(ledPin, OUTPUT); // declare the ledPin as OUTPUT
Serial.begin(31250); // set MIDI baud rate
}
void loop()
{
// deal with first piezo
val = analogRead(piezo1);
if (val >= THRESHOLD) {
noteOn (0x90 , note, 0x40);
digitalWrite(ledPin, HIGH);
delay(100);
}
// plays a MIDInote doesn't check to see that cmd is greater than 127 or that data values are less than 127
void noteOn(char cmd, char data1,char data 2) {
Serial.print(cmd, BYTE);
Serial.print(data1, BYTE);
Serial.print(data2, BYTE);
}