cleanup of basic example

use LED_BUILTIN
This commit is contained in:
lathoub 2020-03-22 15:34:12 +01:00
parent d6ac0f6b82
commit 5699e3fe00
1 changed files with 3 additions and 5 deletions

View File

@ -6,11 +6,9 @@
MIDI_CREATE_DEFAULT_INSTANCE();
static const unsigned ledPin = 13; // LED pin on Arduino Uno
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
MIDI.begin(4); // Launch MIDI and listen to channel 4
}
@ -18,10 +16,10 @@ void loop()
{
if (MIDI.read()) // If we have received a message
{
digitalWrite(ledPin, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(42, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(42, 0, 1); // Stop the note
digitalWrite(ledPin, LOW);
digitalWrite(LED_BUILTIN, LOW);
}
}