doc: Update example
This commit is contained in:
parent
47ce2acc16
commit
ce57d26d2c
|
|
@ -1,19 +1,21 @@
|
|||
#include <MIDI.h>
|
||||
|
||||
// Simple tutorial on how to receive and send MIDI messages.
|
||||
// Simple tutorial on how to receive and send MIDI messages
|
||||
// on a different serial port, using SoftwareSerial.
|
||||
// Here, when receiving any message on channel 4, the Arduino
|
||||
// will blink a led and play back a note for 1 second.
|
||||
|
||||
#if defined(ARDUINO_SAM_DUE) || defined(SAMD_SERIES)
|
||||
/* example not relevant for this hardware */
|
||||
/* example not relevant for this hardware (SoftwareSerial not supported) */
|
||||
MIDI_CREATE_DEFAULT_INSTANCE();
|
||||
#else
|
||||
#include <SoftwareSerial.h>
|
||||
using Transport = MIDI_NAMESPACE::SerialMIDI<SoftwareSerial>;
|
||||
int rxPin = 18;
|
||||
int txPin = 19;
|
||||
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
|
||||
MIDI_NAMESPACE::SerialMIDI<SoftwareSerial> serialMIDI(mySerial);
|
||||
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<SoftwareSerial>> MIDI((MIDI_NAMESPACE::SerialMIDI<SoftwareSerial>&)serialMIDI);
|
||||
Transport serialMIDI(mySerial);
|
||||
MIDI_NAMESPACE::MidiInterface<Transport> MIDI((Transport&)serialMIDI);
|
||||
#endif
|
||||
|
||||
void setup()
|
||||
|
|
|
|||
Loading…
Reference in New Issue