I need help with my much error with this code
try2.ino:4:2: error: invalid preprocessing directive #CapacitiveSensor
try2.ino: In function 'void loop()':
try2:19: error: 'cs_2_3' was not declared in this scope
try2:20: error: 'cs_2_4' was not declared in this scope
try2.ino: At global scope:
try2:42: error: 'look' does not name a type
//////////////////////////////////////////
#include <CapacitiveSensor.h>
#CapacitiveSensor cs_2_4 = CapacitiveSensor(2,4);
int velocity = 100;//velocity of MIDI notes, must be between 0 and 127
//(higher velocity usually makes MIDI instruments louder)
int noteON = 144;//144 = 10010000 in binary, note on command
void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
}
void loop() {
long total1 = cs_2_3.capacitiveSensor(30);
long total2 = cs_2_4.capacitiveSensor(30);
if (total1 > 500) {
for (int note=48;note<49;note++) {//from note 50 (D3) to note 69 (A4)
MIDImessage(noteON, note, velocity);//turn note on
delay(500);
MIDImessage(noteON, note, 0);}}//turn note off
if (total2 > 500) {
for (int note=49;note<50;note++) {//from note 50 (D3) to note 69 (A4)
MIDImessage(noteON, note, velocity);//turn note on
delay(500);//hold note for 300ms
MIDImessage(noteON, note, 0);}}//turn note off
}
//send MIDI message
void MIDImessage(int command, int MIDInote, int MIDIvelocity) {
Serial.write(command);//send note on or note off command
Serial.write(MIDInote);//send pitch data
Serial.write(MIDIvelocity);//send velocity data
}
look here too
http://forum.arduino.cc/index.php?topic=210505.0