aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRalf Kistner <ralf@embarkmobile.com>2014-09-16 10:20:12 +0200
committerRalf Kistner <ralf@embarkmobile.com>2014-09-16 10:20:12 +0200
commit4221b24b041dbaaf58d0e3bcfc7a5c202cc31260 (patch)
tree06372e9584280a69c7d03a6d82c34af5b4ea9322 /README.md
parent2b8d8a707df119125d2f78fc6c707274a2888886 (diff)
Add example to change controller value
Diffstat (limited to 'README.md')
-rw-r--r--README.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/README.md b/README.md
index 91f99f7..6f9ebc5 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,16 @@ void noteOff(byte channel, byte pitch, byte velocity) {
MIDIUSB.write(noteOff);
}
+// First parameter is the event type (0x0B = control change).
+// Second parameter is the event type, combined with the channel.
+// Third parameter is the control number number (0-119).
+// Fourth parameter is the control value (0-127).
+
+void controlChange(byte channel, byte control, byte value) {
+ MIDIEvent event = {0x0B, 0xB0 | channel, pitch, velocity};
+ MIDIUSB.write(event);
+}
+
void loop() {
noteOn(0, 48, 64); // Channel 0, middle C, normal velocity
MIDIUSB.flush();
@@ -57,6 +67,8 @@ void loop() {
noteOff(0, 48, 64); // Channel 0, middle C, normal velocity
MIDIUSB.flush();
delay(1500);
+
+ // controlChange(0, 10, 65); // Set the value of controller 10 on channel 0 to 65
}
void setup() {