I’m an experienced programmer and electronics engineer, but new to Arduino.
I started with a very simple blink sketch like this…
int led = 13;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH);
delay(2000);
digitalWrite(led, LOW);
delay(1000);
}
That all works fine. If I disconnect USB or power and reconnect, it all starts up again as you would expect.
However I’m working towards some MIDI control so I extended it like this…
#include <MIDI.h>
int led = 13;
void setup() {
pinMode(led, OUTPUT);
MIDI.begin();
}
void loop() {
digitalWrite(led, HIGH);
MIDI.sendNoteOn(42,127,1);
delay(2000);
digitalWrite(led, LOW);
MIDI.sendNoteOff(42,0,1);
delay(1000);
}
So the only difference is including the class, adding MIDI.begin and the 2 sendNote lines.
This also works fine and you can see both the Pin 13 LED and the TX LED flashing as you would expect.
BUT…
If you remove the USB connection to power down the board, when you replace it, the program doesn’t restart - no flashing lights. Applying 9v power instead of USB makes no difference - still doesn’t start.
I guess I’m missing something very obvious here, but any idea what???
Thanks
Steve