From 5ad56d8e925264bda9f7c34694623635cc43d7c4 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sun, 18 Oct 2020 13:27:32 -0600 Subject: [PATCH] Add bag --- synth.ino | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/synth.ino b/synth.ino index ae94c86..e93c364 100644 --- a/synth.ino +++ b/synth.ino @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "synth.h" #include "patches.h" @@ -22,6 +23,7 @@ int currentPatch = 0; Adafruit_MPR121 cap = Adafruit_MPR121(); Adafruit_NeoTrellisM4 trellis = Adafruit_NeoTrellisM4(); MicroOLED oled(9, 1); +QwiicButton bag; // Hat tip to Kyle Gann // https://www.kylegann.com/tuning.html @@ -85,6 +87,9 @@ void setup(){ oled.begin(); oled.clear(ALL); + // Initialize bag + bag.begin(); + // Initialize the Trellis trellis.begin(); @@ -228,7 +233,6 @@ void loop() { uint8_t glissandoKeys = 0; uint8_t glissandoNote; float glissandoOpenness = 0; - bool bag = false; bool silent = false; bool knee = cap.filteredData(KNEE_OFFSET) < CLOSEDVAL; uint8_t buttons = trellis.isPressed(BUTTON_DOWN)?1:0 | trellis.isPressed(BUTTON_UP)?2:0; @@ -273,7 +277,7 @@ void loop() { // Jump octave if the bag is squished //bag = !digitalRead(BAG); - if (bag) { + if (bag.isPressed()) { if (keys & bit(7)) { note += 12; glissandoNote += 12;