benoit-roussel_turntable/midi/midi.ino

34 lines
635 B
C++

#include "MIDIUSB.h"
#define NUM_BUTTONS 7
// https://github.com/arduino/tutorials/blob/master/ArduinoZeroMidi/PitchToNote.h
uint8_t intensity = 127;
void setup(){
}
void loop(){
noteOn(0, 95, intensity);
MidiUSB.flush();
delay(1000);
noteOff(0, 95, 0);
MidiUSB.flush();
delay(1000);
}
void noteOn(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity};
MidiUSB.sendMIDI(noteOn);
}
void noteOff(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity};
MidiUSB.sendMIDI(noteOff);
}