Skip to content

Commit 1640504

Browse files
author
lathoub
committed
Create Hairless.ino
1 parent e83ea63 commit 1640504

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

examples/Hairless/Hairless.ino

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <MIDI.h>
2+
USING_NAMESPACE_MIDI
3+
4+
struct MySerialSettings : public MIDI_NAMESPACE::DefaultSerialSettings
5+
{
6+
static const long BaudRate = 115200;
7+
};
8+
9+
unsigned long t1 = millis();
10+
11+
MIDI_NAMESPACE::SerialMIDI<HardwareSerial, MySerialSettings> serialMIDI(Serial1);
12+
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<HardwareSerial, MySerialSettings>> MIDI((MIDI_NAMESPACE::SerialMIDI<HardwareSerial, MySerialSettings>&)serialMIDI);
13+
14+
void setup()
15+
{
16+
MIDI.begin(1);
17+
}
18+
19+
void loop()
20+
{
21+
MIDI.read();
22+
23+
// send a note every second
24+
if ((millis() - t1) > 1000)
25+
{
26+
t1 = millis();
27+
28+
MIDI.sendNoteOn(random(1, 127), 55, 1);
29+
}
30+
}

0 commit comments

Comments
 (0)