-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArduinoMIDI.ino
More file actions
54 lines (42 loc) · 984 Bytes
/
ArduinoMIDI.ino
File metadata and controls
54 lines (42 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
Name: ArduinoMIDI.ino
Created: 3/26/2024 2:11:23 PM
Author: kpzip
*/
#include "src/lib.h"
#define SERIAL Serial
#define SERIAL_1 Serial1
#define SERIAL_2 Serial2
#define SERIAL_3 Serial3
#define DEBUG_PIN 8
static int previous_state = HIGH;
// the setup function runs once when you press reset or power the board
void setup() {
MIDI::setup(SERIAL);
//lcd::setup();
// Debug
pinMode(DEBUG_PIN, INPUT_PULLUP);
//pinMode(9, OUTPUT);
//pinMode(10, OUTPUT);
}
// the loop function runs over and over again until power down or reset
void loop() {
/*
MIDI::noteOn(0, 60);
delay(2000);
MIDI::noteOff(0, 60);
delay(2000);*/
int current_state = digitalRead(DEBUG_PIN);
//digitalWrite(9, current_state);
//digitalWrite(10, previous_state);
if (current_state != previous_state) {
if (current_state == LOW) {
MIDI::noteOn(0, 60);
}
else {
MIDI::noteOff(0, 60);
}
previous_state = current_state;
}
delay(2000);
}