int sensorPin = A0; int sensorValue = 0; int channel = 0 // this is the midi channel void setup() { Serial.begin(9600); } void loop() { midiNoteOn(0,127); // turn note ZERO at pitch 127 (max) delay(1000); midiNoteOff(0); // turn off note ZERO delay(1000); } void midiNoteOn(byte note, byte midiVelocity) { Serial.write(144 + channel); //NOTE_ON_CMD (its base + channel # starting at ZERO!) Serial.write(note); Serial.write(midiVelocity); } void midiNoteOff(byte note, byte midiVelocity) { Serial.write(128 + channel); // NOTE_OFF_CMD (its base + channel # starting at ZERO!) Serial.write(note); Serial.write(midiVelocity); }