From 789672385420c2b537b008ae1a6db1cb0af24db6 Mon Sep 17 00:00:00 2001 From: Pieter Pas Date: Sun, 29 May 2022 02:37:55 +0200 Subject: [PATCH] Cleanup Remove unused files and very old examples --- TODO.md | 120 ------ coverage/.gitignore | 2 - .../Ex.01.Potentiometer.ino | 26 -- .../very-old/Ex.02.Button/Ex.02.Button.ino | 28 -- .../Ex.03.Rotary-Encoder.ino | 38 -- .../very-old/Ex.04.Swtich/Ex.04.Swtich.ino | 29 -- .../Ex.05.HiRes-Potentiometer.ino | 24 -- .../very-old/Ex.06.Banks/Ex.06.Banks.ino | 91 ---- .../Ex.07.BankSelectors.ino | 83 ---- .../Ex.08.Potentiometer-Calibrate.ino | 41 -- .../Ex.09.Bank-Calibrate.ino | 87 ---- .../Ex.10.Debug-MIDI/Ex.10.Debug-MIDI.ino | 56 --- .../Ex.11.Button-Matrix.ino | 41 -- .../Ex.12.AnalogMultiplex.ino | 40 -- .../Ex.13.Shift-Register.ino | 66 --- examples.old/very-old/Ex.14.LED/Ex.14.LED.ino | 33 -- .../Ex.15.LED-Shift-Register.ino | 75 ---- .../Ex.16.ProgramSelector.ino | 31 -- .../Ex.17.Transposer/Ex.17.Transposer.ino | 44 -- .../MIDI_Controller_finished_example.ino | 76 ---- examples.old/very-old/OLED-Demo/OLED-Demo.ino | 199 --------- examples.old/very-old/examples.h | 402 ------------------ 22 files changed, 1632 deletions(-) delete mode 100644 TODO.md delete mode 100644 coverage/.gitignore delete mode 100644 examples.old/very-old/Ex.01.Potentiometer/Ex.01.Potentiometer.ino delete mode 100644 examples.old/very-old/Ex.02.Button/Ex.02.Button.ino delete mode 100644 examples.old/very-old/Ex.03.Rotary-Encoder/Ex.03.Rotary-Encoder.ino delete mode 100644 examples.old/very-old/Ex.04.Swtich/Ex.04.Swtich.ino delete mode 100644 examples.old/very-old/Ex.05.HiRes-Potentiometer/Ex.05.HiRes-Potentiometer.ino delete mode 100644 examples.old/very-old/Ex.06.Banks/Ex.06.Banks.ino delete mode 100644 examples.old/very-old/Ex.07.BankSelectors/Ex.07.BankSelectors.ino delete mode 100644 examples.old/very-old/Ex.08.Potentiometer-Calibrate/Ex.08.Potentiometer-Calibrate.ino delete mode 100644 examples.old/very-old/Ex.09.Bank-Calibrate/Ex.09.Bank-Calibrate.ino delete mode 100644 examples.old/very-old/Ex.10.Debug-MIDI/Ex.10.Debug-MIDI.ino delete mode 100644 examples.old/very-old/Ex.11.Button-Matrix/Ex.11.Button-Matrix.ino delete mode 100644 examples.old/very-old/Ex.12.AnalogMultiplex/Ex.12.AnalogMultiplex.ino delete mode 100644 examples.old/very-old/Ex.13.Shift-Register/Ex.13.Shift-Register.ino delete mode 100644 examples.old/very-old/Ex.14.LED/Ex.14.LED.ino delete mode 100644 examples.old/very-old/Ex.15.LED-Shift-Register/Ex.15.LED-Shift-Register.ino delete mode 100644 examples.old/very-old/Ex.16.ProgramSelector/Ex.16.ProgramSelector.ino delete mode 100644 examples.old/very-old/Ex.17.Transposer/Ex.17.Transposer.ino delete mode 100644 examples.old/very-old/MIDI_Controller_finished_example/MIDI_Controller_finished_example.ino delete mode 100644 examples.old/very-old/OLED-Demo/OLED-Demo.ino delete mode 100644 examples.old/very-old/examples.h diff --git a/TODO.md b/TODO.md deleted file mode 100644 index c4520dc378..0000000000 --- a/TODO.md +++ /dev/null @@ -1,120 +0,0 @@ -## TODO - -- ✔ ~~Change template structure for senders~~ -- More examples with better structure -- ✔ ~~Move Wikis to tttapa.github.io~~ -- ✔ ~~Add FAQ page~~ -- Add Troubleshooting page -- ✔ ~~Add a getter for the button state, and rename `getState()` → update()~~ -- Cleanup structure of display elements. -- Flashing LEDs -- ✔ ~~Motorized faders~~ -- Keywords -- Make many protected functions private if 1) they are not needed in tests 2) - they should not be called from within subclasses. -- ✔ ~~Make it easier to add custom bitmaps~~ -- ✔ ~~Cleanup structure of input elements~~ -- ✔ ~~Extension consistency~~ -- ✔ ~~Malloc → new + smart pointers~~ -- Make constructors of abstract classes protected. -- ✔ ~~Make destructors virtual if necessary. (e.g. callback classes)~~ -- ✔ ~~GitHub template~~ -- ✔ ~~Fix firmware link DFU scripts~~ -- ✔ ~~Move DFU scripts → scripts~~ -- List all TODO's throughout the source code and solve them -- ✔ ~~Full MIDI system common support (BLE)~~ -- ✔ ~~Fix MCU LCD length~~ -- ✔ ~~Return type transposers~~ -- ✔ ~~Selection transposers~~ -- optimized ExtIO for boards with tons of RAM? -- ✔ ~~Output only MIDI debug interface~~ -- Bankable FastLED - -## Specific elements - -### Outputs - -#### MIDI Notes -- ✔ Button -- ✔ Latching Button -- ✔ Buttons -- ✔ Button Matrix - -- ✔ Bankable Button -- ✔ Bankable Latching Button -- ✔ Bankable Buttons -- ✔ Bankable Button Matrix - -#### MIDI CC -- ✔ Button -- ✔ Latching Button -- ✔ Buttons -- ✔ Button Matrix - -- ✔ Potentiometer -- Potentiometers - -- ✔ Rotary Encoder - -- ✔ Bankable Button -- ✔ Bankable Latching Button -- ✔ Bankable Buttons -- ✔ Bankable Button Matrix - -- ✔ Bankable Potentiometer -- Bankable Potentiometers - -- ✔ Bankable Rotary Encoder - -#### MIDI Pitch Bend -- ✔ Potentiometer -- Potentiometers -- Motorized fader - -- ✔ Bankable Potentiometer -- Bankable Potentiometers -- Bankable Motorized fader - - -### Inputs - -#### Generic -- ✔ LED - -- ✔ Bankable LED - -#### MCU -- ✔ VPotRing -- ✔ VU -- ✔ Assignment display -- ✔ Time display -- ✔ LCD display (SysEx) -- Flashing LED - -- ✔ Bankable VPotRing -- ✔ Bankable VU -- Flashing LED - - -### Display -- ✔ Selectors -- ✔ VPotRing -- ✔ VU -- ✔ LED Bitmap -- ✔ Timedisplay -- ✔ Assignment display -- ✔ LCD - - -### Selectors -- ✔ Switch -- Latching -- ✔ Encoder -- ✔ Increment -- ✔ Increment/Decrement -- ✔ Many Buttons - -### Selectable -- ✔ Bank -- ✔ Program Change -- ✔ Transpose diff --git a/coverage/.gitignore b/coverage/.gitignore deleted file mode 100644 index c96a04f008..0000000000 --- a/coverage/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/examples.old/very-old/Ex.01.Potentiometer/Ex.01.Potentiometer.ino b/examples.old/very-old/Ex.01.Potentiometer/Ex.01.Potentiometer.ino deleted file mode 100644 index e343c85016..0000000000 --- a/examples.old/very-old/Ex.01.Potentiometer/Ex.01.Potentiometer.ino +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @example Ex.01.Potentiometer.ino - * - * This is an example of the `CCPotentiometer` class of the Control_Surface library. - * - * Connect a potentiometer to analog pin A0. This will be the MIDI channel volume of channel 1. - * Map it in your DAW or DJ software. - * - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -// Create a new instance of the class `CCPotentiometer`, called `potentiometer`, -// on pin A0, that sends MIDI messages with controller 7 (channel volume) -// on channel 1 -CCPotentiometer potentiometer(A0, MIDI_CC::Channel_Volume, 1); - -void setup() {} - -void loop() { - // Update the Control Surface (check whether the potentiometer's - // input has changed since last time, if so, send the new value over MIDI). - Control_Surface.update(); -} diff --git a/examples.old/very-old/Ex.02.Button/Ex.02.Button.ino b/examples.old/very-old/Ex.02.Button/Ex.02.Button.ino deleted file mode 100644 index 74ddf10255..0000000000 --- a/examples.old/very-old/Ex.02.Button/Ex.02.Button.ino +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @example Ex.02.Button.ino - * - * This is an example of the Digital class of the Control_Surface library. - * - * Connect a push buttons to digital pin 2. Connect the other pin of the button to the ground, - * a pull-up resistor is not necessary, because the internal one will be used. - * This button will play MIDI note C4 when pressed. - * Map it in your DAW or DJ software. - * - * Written by tttapa, 08/09/2017 - * https://github.com/tttapa/Control-Surface -*/ - -#include // Include the library - -const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127) -const uint8_t C4 = 60; // Note number 60 is defined as middle C in the MIDI specification - -// Create a new instance of the class 'Digital', called 'button', on pin 2, that sends MIDI messages with note 'C4' (60) on channel 1, with velocity 127 -Digital button(2, C4, 1, velocity); - -void setup() {} - -void loop() { - // Refresh the button (check whether the button's state has changed since last time, if so, send it over MIDI) - Control_Surface.refresh(); -} \ No newline at end of file diff --git a/examples.old/very-old/Ex.03.Rotary-Encoder/Ex.03.Rotary-Encoder.ino b/examples.old/very-old/Ex.03.Rotary-Encoder/Ex.03.Rotary-Encoder.ino deleted file mode 100644 index b7c9061e6c..0000000000 --- a/examples.old/very-old/Ex.03.Rotary-Encoder/Ex.03.Rotary-Encoder.ino +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @example Ex.03.Rotary-Encoder.ino - * - * This is an example of the RotaryEncoder class of the Control_Surface library. - * - * Connect the A and B pins of the encoder to 2 interrupt pins (2 and 3). - * It's recommended to use 100nF capacitors between the A and B pins and ground (hardware debounce). - * Connect the common (C) pin to the ground. Pull-up resistors are not necessary, since the internal ones will be used. - * Map the control change message 0x14 to the right control in your DJ or DAW software, - * and select 'relative' instead of 'absolute'. - * - * If you are using a jog wheel, use JOG, if you are using a normal encoder - * (for normal controls like EQ or volume etc.) use NORMAL_ENCODER. - * If you have strange results in your software, try a different relative mode: - * TWOS_COMPLEMENT, BINARY_OFFSET or SIGN_MAGNITUDE. - * If the control works, but it goes in the wrong direction, swap the pins A and B of the encoder - * (either physically, or by swapping the pin numbers in the RotaryEncoder constructor). - * - * Written by Pieter P, 22-08-2017 - * https://github.com/tttapa/Control-Surface -*/ - -#include - -const uint8_t Channel = 1; // MIDI channel 1 -const uint8_t Controller = 0x14; // MIDI Control Change controller number -const int speedMultiply = 1; // No change in speed of the encoder (number of steps is multiplied by 1) - -// Create a new instance of the class 'RotaryEncoder', called 'enc', on pin 2 and 3, controller number 0x14, on channel1, -// no change in speed (speed is multiplied by 1), it's used as a jog wheel, and the sign mode is set to two's complement. -RotaryEncoder encoder(2, 3, Controller, Channel, speedMultiply, JOG, TWOS_COMPLEMENT); - -void setup() {} - -void loop() { - // Refresh the encoder (check whether the position has changed since last time, if so, send the difference over MIDI) - Control_Surface.refresh(); -} diff --git a/examples.old/very-old/Ex.04.Swtich/Ex.04.Swtich.ino b/examples.old/very-old/Ex.04.Swtich/Ex.04.Swtich.ino deleted file mode 100644 index a6ad5dbba6..0000000000 --- a/examples.old/very-old/Ex.04.Swtich/Ex.04.Swtich.ino +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @example Ex.04.Switch.ino - * - * This is an example of the DigitalLatch class of the Control_Surface library. - * - * Connect a toggle switch to digital pin 2. Connect the other pin of the switch to the ground, - * a pull-up resistor is not necessary, because the internal one will be used. - * The switch will briefly play MIDI note C4 when flipped. - * Map it in your DAW or DJ software. - * - * Written by tttapa, 08/09/2017 - * https://github.com/tttapa/Control-Surface -*/ - -#include // Include the library - -const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127) -const uint8_t C4 = 60; // Note number 60 is defined as middle C in the MIDI specification -const unsigned long duration = 100; // The duration of the MIDI note (in milliseconds) - -// Create a new instance of the class 'DigitalLatch', called 'toggleSwitch', on pin 2, that sends MIDI messages with note 'C4' (60) on channel 1, with velocity 127 and a duration of 100ms -DigitalLatch toggleSwitch(2, C4, 1, velocity, duration); - -void setup() {} - -void loop() { - // Refresh the button (check whether the button's state has changed since last time, if so, send it over MIDI) - Control_Surface.refresh(); -} \ No newline at end of file diff --git a/examples.old/very-old/Ex.05.HiRes-Potentiometer/Ex.05.HiRes-Potentiometer.ino b/examples.old/very-old/Ex.05.HiRes-Potentiometer/Ex.05.HiRes-Potentiometer.ino deleted file mode 100644 index 85604684e5..0000000000 --- a/examples.old/very-old/Ex.05.HiRes-Potentiometer/Ex.05.HiRes-Potentiometer.ino +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @example Ex.05.HiRes-Potentiometer.ino - * - * This is an example of the AnalogPB class of the Control_Surface library. - * - * Connect a potentiometer to analog pin A0. It will send MIDI Pitch Bend messages on channel 1. - * Map it in your DAW or DJ software. - * - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -// Create a new instance of the class 'AnalogPB', called 'potentiometer', on pin A0, -// that sends MIDI Pitch Bend messages on channel 1 -AnalogPB potentiometer(A0, 1); - -void setup() {} - -void loop() { - // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI) - Control_Surface.refresh(); -} \ No newline at end of file diff --git a/examples.old/very-old/Ex.06.Banks/Ex.06.Banks.ino b/examples.old/very-old/Ex.06.Banks/Ex.06.Banks.ino deleted file mode 100644 index 1857341b9b..0000000000 --- a/examples.old/very-old/Ex.06.Banks/Ex.06.Banks.ino +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @example Ex.06.Banks.ino - * - * This is an example of the Bank class of the Control_Surface library. - * - * Connect two potentiometers to analog pins A0 and A1, - * and two pushbuttons to pins 2 and 3. - * - * Connect a toggle switch to pin 11. - * - * When the toggle switch is turned off: - * - Potentiometer A is channel volume of track 1 (Controller number 0x07, MIDI channel 1) - * - Potentiometer B is channel volume of track 2 (Controller number 0x07, MIDI channel 2) - * - Mute button A is the mute button for track 1 (Note number 0x10, MIDI channel 1) - * - Mute button B is the mute button for track 2 (Note number 0x11, MIDI channel 1) - * - * When the toggle switch is turned on: - * - Potentiometer A is channel volume of track 3 (Controller number 0x07, MIDI channel 3) - * - Potentiometer B is channel volume of track 4 (Controller number 0x07, MIDI channel 4) - * - Mute button A is the mute button for track 3 (Note number 0x12, MIDI channel 1) - * - Mute button B is the mute button for track 4 (Note number 0x13, MIDI channel 1) - * - * This allows you to control multiple tracks with only a limited amount of physical potentiometers and buttons - * - * Map accordingly in your DAW or DJ software. - * - * Note: It is recommended to use a BankSelector (See Ex.07.BankSelectors.ino) instead of changing the bank setting manually. - * - * ### How it works: - @par - When the bank setting is set to 1, - - 2 (i.e. the number of tracks per bank) will be added to the channel number of the potentiometers. - This is because they were added to the bank using the CHANGE_CHANNEL mode. - - 2 (i.e. the number of tracks per bank) will be added to the note numbers of the buttons. - This is because they were added to the bank using the CHANGE_ADDRESS mode; - - - ### In general: - @par - For controls that were added using the CHANGE_ADDRESS mode: - - The address will be: startAddress + tracksPerBank * bankSetting - - The channel won't change. - @par - For controls that were added using the CHANGE_CHANNEL mode: - - The channel will be: startChannel + tracksPerBank * bankSetting - - The address won't change. - - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -const pin_t bankSwitchPin = 11; // The pin with the bank selection switch connected - -// Create a two new instances of the class 'Analog', on pins A0 and A1, -// that send MIDI messages with controller 7 (channel volume) on channels 1 and 2 -Analog potentiometer_A(A0, MIDI_CC::Channel_Volume, 1); -Analog potentiometer_B(A1, MIDI_CC::Channel_Volume, 2); - -// Create a two new instances of the class 'Digital', on pins 2 and 3, -// that send MIDI messages with note numbers 0x10 and 0x11 on MIDI channel 1 -Digital muteButton_A(2, 0x10, 1); -Digital muteButton_B(3, 0x11, 1); - -// Create a new bank that has two tracks per bank -Bank bank(2); - -/*_______________________________________________________________________________________________________________________________________*/ - -void setup() { - // Add the created objects to the bank - bank.add(potentiometer_A, Bank::CHANGE_CHANNEL); // When the bank setting is changed, change the channel of the potentiometer - bank.add(potentiometer_B, Bank::CHANGE_CHANNEL); - bank.add(muteButton_A, Bank::CHANGE_ADDRESS); // When the bank setting is changed, change the address (note number) of the mute button - bank.add(muteButton_B, Bank::CHANGE_ADDRESS); - - pinMode(bankSwitchPin, INPUT_PULLUP); -} - -/*_______________________________________________________________________________________________________________________________________*/ - -void loop() { - if (digitalRead(bankSwitchPin) == LOW) // if the bank switch is switched on - bank.select(1); // select tracks 3 and 4 - else - bank.select(0); // select tracks 1 and 2 - - // Refresh the MIDI controller (check whether the inputs have changed since last time, if so, send the new value over MIDI) - Control_Surface.refresh(); -} \ No newline at end of file diff --git a/examples.old/very-old/Ex.07.BankSelectors/Ex.07.BankSelectors.ino b/examples.old/very-old/Ex.07.BankSelectors/Ex.07.BankSelectors.ino deleted file mode 100644 index fa6bef342c..0000000000 --- a/examples.old/very-old/Ex.07.BankSelectors/Ex.07.BankSelectors.ino +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @example Ex.07.BankSelectors.ino - * - * This is an example of the BankSelector class of the Control_Surface library. - * - * Connect two potentiometers to analog pins A0 and A1, - * and two pushbuttons to pins 2 and 3. - * - * Connect push buttons to pins 11 and 12, and 4 LEDs (+ current limiting resitors) to pins 4, 5, 6 and 7. - * - * When bank 1 is selected: - * - Potentiometer A is channel volume of track 1   (Controller number 0x07, MIDI channel 1) - * - Potentiometer B is channel volume of track 2   (Controller number 0x07, MIDI channel 2) - * - Mute button A is the mute button for track 1   (Note number 0x10, MIDI channel 1) - * - Mute button B is the mute button for track 2   (Note number 0x11, MIDI channel 1) - * - The LED on pin 4 lights up. - * - * When bank 2 is selected: - * - Potentiometer A is channel volume of track 3   (Controller number 0x07, MIDI channel 3) - * - Potentiometer B is channel volume of track 4   (Controller number 0x07, MIDI channel 4) - * - Mute button A is the mute button for track 3   (Note number 0x12, MIDI channel 1) - * - Mute button B is the mute button for track 4   (Note number 0x13, MIDI channel 1) - * - The LED on pin 5 lights up. - * - * When bank 3 is selected: - * - Potentiometer A is channel volume of track 5   (Controller number 0x07, MIDI channel 5) - * - Potentiometer B is channel volume of track 6   (Controller number 0x07, MIDI channel 6) - * - Mute button A is the mute button for track 5   (Note number 0x14, MIDI channel 1) - * - Mute button B is the mute button for track 6   (Note number 0x15, MIDI channel 1) - * - The LED on pin 6 lights up. - * - * When bank 4 is selected: - * - Potentiometer A is channel volume of track 7   (Controller number 0x07, MIDI channel 7) - * - Potentiometer B is channel volume of track 8   (Controller number 0x07, MIDI channel 8) - * - Mute button A is the mute button for track 7   (Note number 0x16, MIDI channel 1) - * - Mute button B is the mute button for track 8   (Note number 0x17, MIDI channel 1) - * - The LED on pin 7 lights up. - * - * This allows you to control multiple tracks with only a limited amount of physical potentiometers and buttons - * - * Map accordingly in your DAW or DJ software. - * - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface -*/ - -#include // Include the library - -// Create a two new instances of the class 'Analog', on pins A0 and A1, -// that send MIDI messages with controller 7 (channel volume) on channels 1 and 2 -Analog potentiometer_A(A0, MIDI_CC::Channel_Volume, 1); -Analog potentiometer_B(A1, MIDI_CC::Channel_Volume, 2); - -// Create a two new instances of the class 'Digital', on pins 2 and 3, -// that send MIDI messages with note numbers 0x10 and 0x11 on MIDI channel 1 -Digital muteButton_A(2, 0x10, 1); -Digital muteButton_B(3, 0x11, 1); - -// Create a new bank that has two tracks per bank -Bank bank(2); - -// Create a new bank selector that changes the bank setting of the bank we just created -// It has pushbuttons connected to pins 11 and 12 that increment or decrement the bank setting, -// and 4 LEDs to pins 4, 5, 6 and 7 that display the current bank setting. -BankSelector bankSelector(bank, { 11, 12 }, { 4, 5, 6, 7 } ); - -/*_______________________________________________________________________________________________________________________________________*/ - -void setup() { - // Add the created objects to the bank - bank.add(potentiometer_A, Bank::CHANGE_CHANNEL); // When the bank setting is changed, change the channel of the potentiometer - bank.add(potentiometer_B, Bank::CHANGE_CHANNEL); - bank.add(muteButton_A, Bank::CHANGE_ADDRESS); // When the bank setting is changed, change the address (note number) of the mute button - bank.add(muteButton_B, Bank::CHANGE_ADDRESS); -} - -/*_______________________________________________________________________________________________________________________________________*/ - -void loop() { - // Refresh the MIDI controller (check whether the inputs have changed since last time, if so, send the new value over MIDI) - // It also refreshes the bank selector - Control_Surface.refresh(); -} \ No newline at end of file diff --git a/examples.old/very-old/Ex.08.Potentiometer-Calibrate/Ex.08.Potentiometer-Calibrate.ino b/examples.old/very-old/Ex.08.Potentiometer-Calibrate/Ex.08.Potentiometer-Calibrate.ino deleted file mode 100644 index 52c867f440..0000000000 --- a/examples.old/very-old/Ex.08.Potentiometer-Calibrate/Ex.08.Potentiometer-Calibrate.ino +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @example Ex.08.Potentiometer-Calibrate.ino - * - * This is an example of the AnalogCC and AnalogPB classes of the Control_Surface library. - * - * Connect a potentiometer to analog pin A0. This will be the MIDI channel volume of channel 1. - * - * Map it in your DAW or DJ software. - * - * Set 'minimumValue' to the analog value read when the potentiometer is in the minimum position. - * Set 'maximumValue' to the analog value read when the potentiometer is in the maximum position. - * - * Written by Pieter P, 20-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -// Create a new instance of the class 'Analog', called 'potentiometer', on pin A0, -// that sends MIDI messages with controller 7 (channel volume) on channel 1 -Analog potentiometer(A0, MIDI_CC::Channel_Volume, 1); - -const int minimumValue = 3; // the analog value read when the potentiometer is in the minimum position. -const int maximumValue = 1020; // the analog value read when the potentiometer is in the maximum position. - -int mapCalibrated(int value) { - value = constrain(value, minimumValue, maximumValue); // make sure that the analog value is between the minimum and maximum value - return map(value, minimumValue, maximumValue, 0, 1023); // map the value from [minimumValue, maximumValue] to [0, 1023] -} - -void setup() { - potentiometer.map(mapCalibrated); // apply the 'mapCalibrated' function on the analog input of 'potentiometer' - // If you add all potentiometers to a bank, you can use Bank::map to apply - // the same mapping function to all AnalogCC and AnalogPB elements in the bank - // (see Ex.09.Bank-Calibrate.ino) -} - -void loop() { - // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI) - Control_Surface.refresh(); -} diff --git a/examples.old/very-old/Ex.09.Bank-Calibrate/Ex.09.Bank-Calibrate.ino b/examples.old/very-old/Ex.09.Bank-Calibrate/Ex.09.Bank-Calibrate.ino deleted file mode 100644 index b69db0eaa8..0000000000 --- a/examples.old/very-old/Ex.09.Bank-Calibrate/Ex.09.Bank-Calibrate.ino +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @example Ex.09.Bank-Calibrate.ino - * - * This is an example of the Bank class of the Control_Surface library. - * - * Connect two potentiometers to analog pins A0 and A1, - * and two pushbuttons to pins 2 and 3. - * - * Connect a toggle switch to pin 11. - * - * When the toggle switch is turned off: - * - Potentiometer A is channel volume of track 1   (Controller number 0x07, MIDI channel 1) - * - Potentiometer B is channel volume of track 2   (Controller number 0x07, MIDI channel 2) - * - Mute button A is the mute button for track 1   (Note number 0x10, MIDI channel 1) - * - Mute button B is the mute button for track 2   (Note number 0x11, MIDI channel 1) - * - * When the toggle switch is turned on: - * - Potentiometer A is channel volume of track 3   (Controller number 0x07, MIDI channel 3) - * - Potentiometer B is channel volume of track 4   (Controller number 0x07, MIDI channel 4) - * - Mute button A is the mute button for track 3   (Note number 0x12, MIDI channel 1) - * - Mute button B is the mute button for track 4   (Note number 0x13, MIDI channel 1) - * - * This allows you to control multiple tracks with only a limited amount of physical potentiometers and buttons - * - * Map accordingly in your DAW or DJ software. - * - * Set 'minimumValue' to the analog value read when the potentiometer is in the minimum position. - * Set 'maximumValue' to the analog value read when the potentiometer is in the maximum position. - * - * Note: It is recommended to use a BankSelector (See Ex.07.BankSelectors) instead of changing the bank setting manually. - * - * Written by Pieter P, 20-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -const pin_t bankSwitchPin = 11; // The pin with the bank selection switch connected - -// Create a two new instances of the class 'Analog', on pins A0 and A1, -// that send MIDI messages with controller 7 (channel volume) on channels 1 and 2 -Analog potentiometer_A(A0, MIDI_CC::Channel_Volume, 1); -Analog potentiometer_B(A1, MIDI_CC::Channel_Volume, 2); - -// Create a two new instances of the class 'Digital', on pins 2 and 3, -// that send MIDI messages with note numbers 0x10 and 0x11 on MIDI channel 1 -Digital muteButton_A(2, 0x10, 1); -Digital muteButton_B(3, 0x11, 1); - -// Create a new bank that has two tracks per bank -Bank bank(2); - -/*_______________________________________________________________________________________________________________________________________*/ - -const int minimumValue = 3; // the analog value read when the potentiometer is in the minimum position. -const int maximumValue = 1020; // the analog value read when the potentiometer is in the maximum position. - -int mapCalibrated(int value) { - value = constrain(value, minimumValue, maximumValue); // make sure that the analog value is between the minimum and maximum value - return map(value, minimumValue, maximumValue, 0, 1023); // map the value from [minimumValue, maximumValue] to [0, 1023] -} - -/*_______________________________________________________________________________________________________________________________________*/ - -void setup() { - // Add the created objects to the bank - bank.add(potentiometer_A, Bank::CHANGE_CHANNEL); // When the bank setting is changed, change the channel of the potentiometer - bank.add(potentiometer_B, Bank::CHANGE_CHANNEL); - bank.add(muteButton_A, Bank::CHANGE_ADDRESS); // When the bank setting is changed, change the address (note number) of the mute button - bank.add(muteButton_B, Bank::CHANGE_ADDRESS); - - bank.map(mapCalibrated); // apply the 'mapCalibrated' function on the analog input value of all Analog objects in the bank - - pinMode(bankSwitchPin, INPUT_PULLUP); -} - -/*_______________________________________________________________________________________________________________________________________*/ - -void loop() { - if (digitalRead(bankSwitchPin) == LOW) // if the bank switch is switched on - bank.select(1); // select tracks 3 and 4 - else - bank.select(0); // select tracks 1 and 2 - - // Refresh the MIDI controller (check whether the inputs have changed since last time, if so, send the new value over MIDI) - Control_Surface.refresh(); -} \ No newline at end of file diff --git a/examples.old/very-old/Ex.10.Debug-MIDI/Ex.10.Debug-MIDI.ino b/examples.old/very-old/Ex.10.Debug-MIDI/Ex.10.Debug-MIDI.ino deleted file mode 100644 index 6822010481..0000000000 --- a/examples.old/very-old/Ex.10.Debug-MIDI/Ex.10.Debug-MIDI.ino +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @example Ex.10.Debug-MIDI.ino - * - * This is an example of the debug functionality of the Control_Surface library. - * - * Connect a push buttons to digital pin 2. Connect the other pin of the button to the ground, - * a pull-up resistor is not necessary, because the internal one will be used. - * This button will play MIDI note C4 when pressed. - * - * Open the Serial Monitor in the Arduino IDE (CTRL+SHIFT+M) and press the button. - * You should see messages like: - * - * - Note On Channel: 1 Data 1: 0x3C Data 2: 0x7F - * - Note Off Channel: 1 Data 1: 0x3C Data 2: 0x7F - * - * You can also send MIDI messages in hexadecimal format: - * For example: `90 3C 7F` (note on, note 0x3C, velocity 0x7F) should turn on the built-in LED. - * `80 3C 7F` (note off, note 0x3C, velocity 0x7F) should turn off the built-in LED. - * - * Written by Pieter P, 20-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -// Instantiate a MIDI interface that sends debug messages to the USB Serial port (Serial Monitor) -USBDebugMIDI_Interface midiInterface(115200); - -const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127) -const uint8_t C4 = 60; // Note number 60 is defined as middle C in the MIDI specification - -// Create a new instance of the class 'Digital', called 'button', on pin 2, that sends MIDI messages with note 'C4' (60) on channel 1, with velocity 127 -Digital button(2, C4, 1, velocity); - -// Create a new instance of the class 'MIDI_LED', called 'led' on the built-in LED, that reacts to MIDI messages with note 'C4' (60) on channel 1. -MIDI_LED led(LED_BUILTIN, C4, 1); - - -void setup() {} - -void loop() { - // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI) - Control_Surface.refresh(); -} - -/** - If you don't explicitly instantiate a MIDI interface, the MIDI Controller library will - instantiate a MIDI interface that sends MIDI messages over the USB connection. - - If you do explicitly instantiate a MIDI interface, like in this example, - it will be used as the default MIDI interface by the MIDI Controller library. - - If you instantiate more than one MIDI interfaces, the interface that's the last - one to be instantiated will be the default output, unless you specify a default - interface using MIDI_Interface.setDefault(). -*/ diff --git a/examples.old/very-old/Ex.11.Button-Matrix/Ex.11.Button-Matrix.ino b/examples.old/very-old/Ex.11.Button-Matrix/Ex.11.Button-Matrix.ino deleted file mode 100644 index 42f9083ff0..0000000000 --- a/examples.old/very-old/Ex.11.Button-Matrix/Ex.11.Button-Matrix.ino +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @example Ex.11.Button-Matrix.ino - * - * This is an example of the ButtonMatrix class of the Control_Surface library. - * - * Connect a 4 × 3 matrix of buttons with the rows to pins 2, 3, 4 and 5, - * and the columns to pins 6, 7 and 8. - * Pull-up resistors are not necessary, because the internal ones will be used. - * - * If you want to be able to press multiple buttons at once, add a diode - * in series with each button, as shown in the following schematic: - * - * @image html Button-matrix.svg - * - * The note numbers are specified in the `addresses` array. - * Map accordingly in your DAW or DJ software. - * - * Written by tttapa, 24/09/2017 - * https://github.com/tttapa/Control-Surface -*/ - -#include "Control_Surface.h" // Include the library - -const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127) -const uint8_t addresses[4][3] = { // the note numbers corresponding to the buttons in the matrix - { 1, 2, 3 }, - { 4, 5, 6 }, - { 7, 8, 9 }, - { 10, 11, 12 } -}; - -// Create a new instance of the class 'ButtonMatrix', called 'buttonmatrix', with dimensions 4 rows and 3 columns, with the rows connected to pins 2, 3, 4 and 5 -// and the columns connected to pins 6, 7 and 8, that sends MIDI messages with the notes specified in 'addresses' on MIDI channel 1, with velocity 127 -ButtonMatrix<4, 3> buttonmatrix( {2, 3, 4, 5}, {6, 7, 8}, addresses, 1, velocity); - -void setup() {} - -void loop() { - // Refresh the buttons (check whether the states have changed since last time, if so, send it over MIDI) - Control_Surface.refresh(); -} diff --git a/examples.old/very-old/Ex.12.AnalogMultiplex/Ex.12.AnalogMultiplex.ino b/examples.old/very-old/Ex.12.AnalogMultiplex/Ex.12.AnalogMultiplex.ino deleted file mode 100644 index 86911e41e7..0000000000 --- a/examples.old/very-old/Ex.12.AnalogMultiplex/Ex.12.AnalogMultiplex.ino +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @example Ex.12.AnalogMultiplex.ino - * - * This is an example of the AnalogMultiplex class of the Control_Surface library. - * - * Connect an analog multiplexer to analog pin A0. Connect the address lines to pins 2, 3 and 4. - * Connect 8 potentiometers to the inputs of the multiplexer. - * These will be the channel volumes - * of MIDI channels 1 through 8. - * Map accordingly in your DAW or DJ software. - * - * Written by Pieter P, 20-09-2017 - * https://github.com/tttapa/Control-Surface -*/ - -#include // Include the library - -// Create an instance of 'AnalogMultiplex' with the output pin of the multiplexer connected to -// analog input pin A0 and the address pins connected to pins 2, 3 and 4. -AnalogMultiplex multiplexer(A0, { 2, 3, 4 } ); - -// Create 8 new instances of the class 'Analog', on the 8 pins of the multiplexer, -// that send MIDI messages with controller 7 (channel volume) on channels 1 - 8 -Analog potentiometers[] = { - { multiplexer.pin(0), MIDI_CC::Channel_Volume, 1 }, - { multiplexer.pin(1), MIDI_CC::Channel_Volume, 2 }, - { multiplexer.pin(2), MIDI_CC::Channel_Volume, 3 }, - { multiplexer.pin(3), MIDI_CC::Channel_Volume, 4 }, - { multiplexer.pin(4), MIDI_CC::Channel_Volume, 5 }, - { multiplexer.pin(5), MIDI_CC::Channel_Volume, 6 }, - { multiplexer.pin(6), MIDI_CC::Channel_Volume, 7 }, - { multiplexer.pin(7), MIDI_CC::Channel_Volume, 8 } -}; - -void setup() {} - -void loop() { - // Update the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI) - Control_Surface.update(); -} diff --git a/examples.old/very-old/Ex.13.Shift-Register/Ex.13.Shift-Register.ino b/examples.old/very-old/Ex.13.Shift-Register/Ex.13.Shift-Register.ino deleted file mode 100644 index e88a1ea959..0000000000 --- a/examples.old/very-old/Ex.13.Shift-Register/Ex.13.Shift-Register.ino +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @example Ex.13.Shift-Register.ino - * - * This is an example of the ShiftRegisterOut class of the Control_Surface library. - * - * Connect a potentiometer to analog pins A0. - * Connect push buttons to pins 2 and 3, and a shift register to pins 10 (ST_CP), 11 (DS) and 13 (SH_CP). - * Connect LEDs (+ current limiting resistors) to the 8 outputs of the shift register. - * - * Pins 2 and 3 increment or decrement the bank setting, and the LEDs display the bank setting. - * - * This allows you to control multiple tracks with only a limited amount of physical potentiometers and buttons. - * - * Depending on the bank setting, the potentiometer will send MIDI Control Change - * as the channel volume of channels 1 through 8. - * Map accordingly in your DAW or DJ software. - * - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -const pin_t dataPin = 11; //Pin connected to DS of 74HC595 -const pin_t clockPin = 13; //Pin connected to SH_CP of 74HC595 -const pin_t latchPin = 10; //Pin connected to ST_CP of 74HC595 - -// Create a new shift register output connected to pins 11, 13 and 10, shift the data out with the most significant bit first, -// There are 8 outputs in total -ShiftRegisterOut ShiftReg(dataPin, clockPin, latchPin, MSBFIRST, 8); - -// Create a new instance of the class `CCPotentiometer`, on pin A0, -// that sends MIDI messages with controller 7 (channel volume) on MIDI channel 1 -CCPotentiometer potentiometer(A0, MIDI_CC::Channel_Volume, 1); - -// Create a new bank that has one track per bank -Bank bank(1); - -// Create a new bank selector that changes the bank setting of the bank we just created -// It has pushbuttons connected to pins 2 and 3 that increment or decrement the bank setting, -// and 8 LEDs connected to the shift register, that display the current bank setting. -BankSelector bankSelector(bank, { 2, 3 }, { - ShiftReg.pin(0), - ShiftReg.pin(1), - ShiftReg.pin(2), - ShiftReg.pin(3), - ShiftReg.pin(4), - ShiftReg.pin(5), - ShiftReg.pin(6), - ShiftReg.pin(7) -}); - -/*_______________________________________________________________________________________________________________________________________*/ - -void setup() { - // Add the potentiometer control object to the bank - bank.add(potentiometer, Bank::CHANGE_CHANNEL); // When the bank setting is changed, change the channel of the potentiometer -} - -/*_______________________________________________________________________________________________________________________________________*/ - -void loop() { - // Update the MIDI controller (check whether the inputs have changed since last time, if so, send the new value over MIDI) - // It also refreshes the bank selector - Control_Surface.update(); -} diff --git a/examples.old/very-old/Ex.14.LED/Ex.14.LED.ino b/examples.old/very-old/Ex.14.LED/Ex.14.LED.ino deleted file mode 100644 index 67a2a3a083..0000000000 --- a/examples.old/very-old/Ex.14.LED/Ex.14.LED.ino +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @example Ex.14.LED.ino - * - * This is an example of the MIDI_LED class of the Control_Surface librar. - * - * Connect two push buttons to pins 2 and 3. Pull-up resistors are not necessary, - * because the internal ones will be used. - * Connect two LEDs (+ current limiting resistors) to pins 12 and 13. - * - * The buttons will mute and un-mute tracks 1 and 2 respectively. The LEDs will - * indicate whether the channel is muted or not. - * - * Configure as a MCU-compatible Control Surface (Mackie Control Universal) in your DAW. - * - * Written by Pieter P, 2018-04-11 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -const uint8_t velocity = 0b1111111; - -Digital button1(2, MCU::MUTE_1, 1, velocity); -Digital button2(3, MCU::MUTE_2, 1, velocity); - -MIDI_LED led1(12, MCU::MUTE_1, 1); // LED on pin 12, note MCU::MUTE_1, channel 1 -MIDI_LED led2(13, MCU::MUTE_2, 1); - -void setup() {} - -void loop() { - Control_Surface.refresh(); -} diff --git a/examples.old/very-old/Ex.15.LED-Shift-Register/Ex.15.LED-Shift-Register.ino b/examples.old/very-old/Ex.15.LED-Shift-Register/Ex.15.LED-Shift-Register.ino deleted file mode 100644 index 3173ddbc68..0000000000 --- a/examples.old/very-old/Ex.15.LED-Shift-Register/Ex.15.LED-Shift-Register.ino +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @example Ex.15.LED-Shift-Register.ino - * - * This is an example of the ShiftRegisterOut class of the Control_Surface library. - * - * Connect three daisy-chained shift registers to pins 11 (ST_CP), 12 (DS) and 10 (SH_CP). - * Connect 8 RGB LEDs (+ current limiting resistors) to the outputs of the shift registers - * (R-G-B-R-G-B-...). - * If blue LEDs light up when red ones should, either flip all the LEDs, or change the - * bit order in the ShiftRegisterOut constructor to 'MSBFIRST' instead fo 'LSBFIRST'. - * - * ``` - * 10 >──────────────┬─────────────────────────────┬─────────────────────────────┐ - * ┏━━━━━━━━━━┷━━━━━━━━━━━┓ ┏━━━━━━━━━━┷━━━━━━━━━━━┓ ┏━━━━━━━━━━┷━━━━━━━━━━━┓ - * ┃ SH_CP ┃ ┃ SH_CP ┃ ┃ SH_CP ┃ - * 12 >───┨ Data in Data out ┠──────┨ Data in Data out ┠──────┨ Data in Data out ┃ - * ┃ ST_CP ┃ ┃ ST_CP ┃ ┃ ST_CP ┃ - * ┗━━━━━━━━━━┯━━━━━━━━━━━┛ ┗━━━━━━━━━━┯━━━━━━━━━━━┛ ┗━━━━━━━━━━┯━━━━━━━━━━━┛ - * 11 >──────────────┴─────────────────────────────┴─────────────────────────────┘ - * ``` - * The 8 LEDs represent 8 channels. A red LED indicates that the channel is muted, - * a green LED indicates that solo is enabled, and a blue LED indicates that the - * channel is armed for recording. - * - * Configure as a MCU-compatible Control Surface (Mackie Control Universal) in your DAW. - * - * Written by Pieter P, 22-03-2018 - * https://github.com/tttapa/Control-Surface - */ - -#include // Include the library - -const pin_t dataPin = 12; //Pin connected to DS of 74HC595 -const pin_t clockPin = 10; //Pin connected to SH_CP of 74HC595 -const pin_t latchPin = 11; //Pin connected to ST_CP of 74HC595 - -// Create a new shift register output connected to pins 11, 13 and 10, shift the data out with the least significant bit first, -// There are 24 (= 3·8) outputs in total. -ShiftRegisterOut ShiftReg(dataPin, clockPin, latchPin, LSBFIRST, 24); - -const uint8_t channel = 1; - -MIDI_LED leds[] = { - {ShiftReg.red(0), MCU::MUTE_1, channel}, - {ShiftReg.red(1), MCU::MUTE_2, channel}, - {ShiftReg.red(2), MCU::MUTE_3, channel}, - {ShiftReg.red(3), MCU::MUTE_4, channel}, - {ShiftReg.red(4), MCU::MUTE_5, channel}, - {ShiftReg.red(5), MCU::MUTE_6, channel}, - {ShiftReg.red(6), MCU::MUTE_7, channel}, - {ShiftReg.red(7), MCU::MUTE_8, channel}, - {ShiftReg.green(0), MCU::SOLO_1, channel}, - {ShiftReg.green(1), MCU::SOLO_2, channel}, - {ShiftReg.green(2), MCU::SOLO_3, channel}, - {ShiftReg.green(3), MCU::SOLO_4, channel}, - {ShiftReg.green(4), MCU::SOLO_5, channel}, - {ShiftReg.green(5), MCU::SOLO_6, channel}, - {ShiftReg.green(6), MCU::SOLO_7, channel}, - {ShiftReg.green(7), MCU::SOLO_8, channel}, - {ShiftReg.blue(0), MCU::REC_RDY_1, channel}, - {ShiftReg.blue(1), MCU::REC_RDY_2, channel}, - {ShiftReg.blue(2), MCU::REC_RDY_3, channel}, - {ShiftReg.blue(3), MCU::REC_RDY_4, channel}, - {ShiftReg.blue(4), MCU::REC_RDY_5, channel}, - {ShiftReg.blue(5), MCU::REC_RDY_6, channel}, - {ShiftReg.blue(6), MCU::REC_RDY_7, channel}, - {ShiftReg.blue(7), MCU::REC_RDY_8, channel}, -}; - -void setup() {} // Nothing to set up - -void loop() { - // Refresh the Control Surface (read MIDI input and update LEDs). - Control_Surface.refresh(); -} diff --git a/examples.old/very-old/Ex.16.ProgramSelector/Ex.16.ProgramSelector.ino b/examples.old/very-old/Ex.16.ProgramSelector/Ex.16.ProgramSelector.ino deleted file mode 100644 index a4af654327..0000000000 --- a/examples.old/very-old/Ex.16.ProgramSelector/Ex.16.ProgramSelector.ino +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @example Ex.16.ProgramSelector.ino - * - * This is an example of the ProgramSelector class of the Control_Surface library. - * - * Connect two push buttons between pins 11 and 12 and ground, - * pull-up resistors are not necessary, because the internal ones will be used. - * - * When the buttons are pressed, the patch number changes (see Selector for - * more information and the use of different selecting modes), and a - * MIDI Program Change event is sent. - * - * Written by Pieter P, 11-04-2018 - * https://github.com/tttapa/Control-Surface -*/ - -#include // Include the library - -const uint8_t channel = 1; -// Patch Selector selecting patches 1, 2, 3 or 4 on MIDI channel 1, -// increment patch number with button connected to pin 11, -// decrement patch number with button connected to pin 12 -ProgramSelector sel( { 1, 2, 3, 4 }, channel, { 11, 12 } ); - -void setup() {} // Nothing to set up - -void loop() { - // Update the control surface, send a Program Change - // event when the patch number changes - Control_Surface.update(); -} \ No newline at end of file diff --git a/examples.old/very-old/Ex.17.Transposer/Ex.17.Transposer.ino b/examples.old/very-old/Ex.17.Transposer/Ex.17.Transposer.ino deleted file mode 100644 index 7ec03ef983..0000000000 --- a/examples.old/very-old/Ex.17.Transposer/Ex.17.Transposer.ino +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @example Ex.17.Transposer.ino - * - * @brief An example demonstrating the transpose function. - * - * Connect 8 buttons to pins 2 - 9, to use as piano keys - * and two buttons to pins 10 - 11 to transpose the notes. - * - * Pressing button 10 once raises the pitch by one semitone, - * if you press it again, the pitch is two semitones higher, etc. - * Pressing button 11 lowers the pitch by one semitone at a time. - * - * Written by Pieter P, 27-05-2018 - * https://github.com/tttapa/Control-Surface - */ - -#include - -Digital buttons[] = { - {2, 0x3C, 1}, // pin 2, note C4, channel 1 - {3, 0x3E, 1}, // pin 3, node D4, channel 1 - {4, 0x40, 1}, // pin 4, note E4, channel 1 - {5, 0x41, 1}, // pin 5, node F4, channel 1 - {6, 0x43, 1}, // pin 6, note G4, channel 1 - {7, 0x45, 1}, // pin 7, node A4, channel 1 - {8, 0x47, 1}, // pin 8, note B4, channel 1 - {9, 0x48, 1}, // pin 9, node C5, channel 1 -}; - -Bank transposedButtons; // Create a bank (i.e. collection of buttons and other inputs) -Transposer transposer(transposedButtons, {10, 11}, -12, +12); // Create a transposer that works on the bank, - // with an increment button on pin 10 and a - // decrement button on pin 11, - // with a minimum of -12 semitones (i.e. - // one octave lower) and a maximum of +12 - // semitones (i.e. one octave higher). - -void setup() { - transposedButtons.add(buttons); // Add the buttons to the bank -} - -void loop() { - Control_Surface.refresh(); // refresh everything -} \ No newline at end of file diff --git a/examples.old/very-old/MIDI_Controller_finished_example/MIDI_Controller_finished_example.ino b/examples.old/very-old/MIDI_Controller_finished_example/MIDI_Controller_finished_example.ino deleted file mode 100644 index d6a1534e87..0000000000 --- a/examples.old/very-old/MIDI_Controller_finished_example/MIDI_Controller_finished_example.ino +++ /dev/null @@ -1,76 +0,0 @@ -/* - This is the code I used for my specific MIDI controller. - I used an Arduino Leonardo with 4 faders on A0-A3, 8 potentiometers on A4-A11, a rotary encoder on pin 0&1, 4 toggle switches on pins 2, 3, 5 and 7, a toggle switch (for bank select) on pin 11, and an LED on pin 13. - - When bank select is 0, faders 1-4 are channel volumes 1-4, potSide 1-4 are pan/balance of channel 1-4, switches 1-4 are mute channel 5-8. - When bank select is 1, faders 1-4 are channel volumes 5-8, potSide 1-4 are pan/balance of channel 5-8, switches 1-4 are mute channel 1-4. - PotTop 1-4 are not in the bank, because I use them as effect or EQ parameters, and they are channel independent. - Enc1 is used for scrolling. - - Note that I used a custom control mapping in my DAW. - - If you are using a Teensy, make sure you have the USB type set to MIDI + Serial. - If you are using an Arduino Uno or Mega, use the HIDUINO firmware for the ATmega16U2. - - - Written by tttapa, 07-09-2017 - https://github.com/tttapa/Control-Surface -*/ - -#include -#include - -const int speedMultiply = 1; // If the jog wheels or other encoders are too slow in your software, increase this value - // (it will be multiplied with the actual speed of the encoder, as the name implies.) Default is 1. - -//_____________________________________________________________________________________________________________________________________________________________________________________________ - -CCPotentiometer faders[] = { - {A0, MIDI_CC::Channel_Volume, 1}, // Create a new instance of class 'Analog' on pin A0, controller number 0x07 (channel volume), on MIDI channel 1. - {A1, MIDI_CC::Channel_Volume, 2}, - {A2, MIDI_CC::Channel_Volume, 3}, - {A3, MIDI_CC::Channel_Volume, 4}, -}; - -CCPotentiometer knobsTop[] = { - {A4, 0x10, 1}, // Create a new instance of class 'Analog' on pin A4, controller number 0x10 (General Purpose Controller 1), on MIDI channel 1. - {A5, 0x11, 1}, - {A6, 0x12, 1}, - {A7, 0x13, 1}, -}; - -CCPotentiometer knobsSide[] = { - {A8, MIDI_CC::Pan, 1}, // Create a new instance of class 'Analog' called 'potSide1', on pin A8, controller number 0x0A (pan), on MIDI channel 1. - {A9, MIDI_CC::Pan, 2}, - {A10, MIDI_CC::Pan, 3}, - {A11, MIDI_CC::Pan, 4}, -}; - -NoteButtonLatching switches[] = { - {2, 0x10, 1}, // Create a new instance of class 'DigitalLatch' on pin 0, note number 16 (mute) on MIDI channel 1 - {3, 0x11, 1}, - {5, 0x12, 1}, - {7, 0x13, 1}, -}; - -RotaryEncoder enc = {1, 0, 0x2F, 1, speedMultiply, NORMAL_ENCODER, TWOS_COMPLEMENT}; // Create a new instance of class 'RotaryEncoder' called enc, on pins 1 and 0, controller number 0x2F, on MIDI channel 1, at normal speed, using a normal encoder (4 pulses per click/step), using the TWOS_COMPLEMENT sign option - -Bank bank(4); // A bank with four channels - -BankSelector bankselector(bank, 11, LED_BUILTIN, BankSelector::TOGGLE); // A bank selector with a single toggle switch on pin 11 and an LED for feedback on pin 13 - -//_____________________________________________________________________________________________________________________________________________________________________________________________ - -void setup() -{ - bank.add(faders, Bank::CHANGE_CHANNEL); // Add the control elements to the bank - bank.add(knobsSide, Bank::CHANGE_CHANNEL); - bank.add(switches, Bank::CHANGE_ADDRESS); -} - -//_____________________________________________________________________________________________________________________________________________________________________________________________ - -void loop() // Refresh all inputs -{ - Control_Surface.update(); -} diff --git a/examples.old/very-old/OLED-Demo/OLED-Demo.ino b/examples.old/very-old/OLED-Demo/OLED-Demo.ino deleted file mode 100644 index 9ce72a7d73..0000000000 --- a/examples.old/very-old/OLED-Demo/OLED-Demo.ino +++ /dev/null @@ -1,199 +0,0 @@ -/** - * @example OLED-Demo.ino - * - * An extensive example demonstrating the use of DisplayElement%s - * to display information from the DAW on a small OLED display. - * - * The example displays the cursor time location, play and record status, - * and for each of the 8 first tracks, it displays: - * mute, solo, record ready, pan, and VU level meter with peak indicator. - * - * @image html "OLED-Demo.png" - * - * Using a BankSelector, it displays two channels at once, and you can - * cycle through four banks to display all 8 tracks. - * - * There are two rotary encoders that control the pan of the selected - * tracks, two mute, solo, record, and select buttons for the tracks, - * and a play and record button. - */ - -#define DISPLAY_GFX // Enable display functions of the Control Surface library (requires Adafruit_GFX to be installed) -#include // Include the Control Surface library - -#include // Include the library for your specific display (it should inherit from Adafruit_GFX) -#include // Include the I²C library for the display - - -/* ------ Display setup ------ */ -/* =========================== */ - -// #define FLIP_DISPLAY // Uncomment to flip the display upside down - -Adafruit_SSD1306 display; // Instantiate a display - -// Implement the display interface -class SSD1306_DisplayInterface : public DisplayInterface { - public: - SSD1306_DisplayInterface(Adafruit_SSD1306 &display) - : disp(display) {} - void display() { - disp.display(); - } - void clearDisplay() { - disp.clearDisplay(); - disp.drawLine(1, 8, 126, 8, WHITE); - } - private: - Adafruit_SSD1306 &disp; -}; - -SSD1306_DisplayInterface dispIface(display); // Instantiate a display interface - -void initializeDisplay() { - display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialize with the display with I²C address 0x3C - Wire.setClock(1800000); // Set the I²C clock to 1.8 MHz (set F_CPU to 96 MHz) -#ifdef FLIP_DISPLAY - display.setRotation(2); -#endif - display.clearDisplay(); - display.display(); -} - - -/* ------- Bank setup -------- */ -/* =========================== */ - -Bank bank(2); // Create a new bank with two tracks per bank (see Ex.06.Banks) - -BankSelector bs(bank, { 4, 5 }, 4); // Create a new bank selector with four bank settings - // and an increment button on pin 4 and a decrement button on pin 5 - // (see Ex.07.BankSelectors) - -/* -- MIDI Control Elements -- */ -/* =========================== */ - -using namespace MCU; // Use MCU namespace for constants - -// Instantiate the buttons (see Ex.02.Button) -Digital channelButtons[] = { - {6, MUTE_1, 1, 127}, - {7, SOLO_1, 1, 127}, - {8, REC_RDY_1, 1, 127}, - {9, V_POT_SELECT_1, 1, 127}, - {10, MUTE_2, 1, 127}, - {11, SOLO_2, 1, 127}, - {12, V_POT_SELECT_2, 1, 127}, -}; - -Digital playButton (14, PLAY, 1, 127); -Digital recordButton (15, RECORD, 1, 127); - -RotaryEncoder encoder_A (0, 1, V_POT_1, 1, 1, NORMAL_ENCODER, MACKIE_CONTROL_RELATIVE); -RotaryEncoder encoder_B (2, 3, V_POT_2, 1, 1, NORMAL_ENCODER, MACKIE_CONTROL_RELATIVE); - - -/* --- MIDI Input Elements --- */ -/* =========================== */ - -// Time display -MCU_TimeDisplay tdisp; - -// Play / Record -MIDIInputElementNote_Buffer play (PLAY, 1, 1, 1); // channel (1), listen to this address only (1), listen to this channel only (1) -MIDIInputElementNote_Buffer record (RECORD, 1, 1, 1); - -// Mute -MIDIInputElementNote_Buffer mute_A (MUTE_1, 1, 4, 1); // channel (1), listen to (4) addresses in total, listen to this channel only (1) -MIDIInputElementNote_Buffer mute_B (MUTE_2, 1, 4, 1); - -// Solo -MIDIInputElementNote_Buffer solo_A (SOLO_1, 1, 4, 1); -MIDIInputElementNote_Buffer solo_B (SOLO_2, 1, 4, 1); - -MIDIInputElementNote_Buffer rudeSolo (RUDE_SOLO, 1, 1, 1); - -// Record arm / ready -MIDIInputElementNote_Buffer recrdy_A (REC_RDY_1, 1, 4, 1); -MIDIInputElementNote_Buffer recrdy_B (REC_RDY_2, 1, 4, 1); - -// VU meters -MCU_VU vu_A (1, 4, false); // track (1), listen to (4) tracks in total, don't decay automatically (false) -MCU_VU vu_B (2, 4, false); - -// VPot rings -MCU_VPot_Ring ring_A (1, 4); // track (1), listen to (4) tracks in total -MCU_VPot_Ring ring_B (2, 4); - - -/* ---- Display Elements ----- */ -/* =========================== */ - -// Time display -TimeDisplay timeDisp(display, tdisp, {0, 0}, 1, WHITE); // position (0, 0), font size (1) - -// Play / Record -NoteDisplay playDisp (display, play, XBM::play_7, {16 + 64, 0}, WHITE); -NoteDisplay recordDisp (display, record, XBM::record_7, {26 + 64, 0}, WHITE); - -// Mute -NoteDisplay muteDisp_A (display, mute_A, XBM::mute_10B, {14, 50}, WHITE); -NoteDisplay muteDisp_B (display, mute_B, XBM::mute_10B, {14 + 64, 50}, WHITE); - -// Solo -NoteDisplay soloDisp_A (display, solo_A, XBM::solo_10B, {14, 50}, WHITE); -NoteDisplay soloDisp_B (display, solo_B, XBM::solo_10B, {14 + 64, 50}, WHITE); - -NoteDisplay rudeSoloDisp (display, rudeSolo, XBM::solo_7, {36 + 64, 0}, WHITE); - -// Record arm / ready -NoteDisplay recrdyDisp_A (display, recrdy_A, XBM::rec_rdy_10B, {14 + 14, 50}, WHITE); -NoteDisplay recrdyDisp_B (display, recrdy_B, XBM::rec_rdy_10B, {14 + 14 + 64, 50}, WHITE); - -// VU meters -VUDisplay vuDisp_A (display, vu_A, {32 + 11, 60}, 16, 3, 1, WHITE); // position (32+11, 60), width (16), bar height (3) px, bar spacing (1) px -VUDisplay vuDisp_B (display, vu_B, {32 + 11 + 64, 60}, 16, 3, 1, WHITE); - -// VPot rings -VPotDisplay vpotDisp_A (display, ring_A, {0, 10}, 16, 13, WHITE); // position (0, 10), outer radius (16) px, inner radius (13) px -VPotDisplay vpotDisp_B (display, ring_B, {64, 10}, 16, 13, WHITE); - -// Bank selector -SelectorDisplay bsDisp_A (display, bs, 1, 2, {0, 50}, 2, WHITE); // first track of the bank (1), two tracks per bank (2), position (0, 50), font size (2) -SelectorDisplay bsDisp_B (display, bs, 2, 2, {64, 50}, 2, WHITE); - - -/* ---------- Setup ---------- */ -/* =========================== */ - -void setup() { - // Add all channel input and control elements to the bank - - bank.add(channelButtons, Bank::CHANGE_ADDRESS); - - bank.add(encoder_A, Bank::CHANGE_ADDRESS); - bank.add(encoder_B, Bank::CHANGE_ADDRESS); - - bank.add(ring_A, Bank::CHANGE_ADDRESS); - bank.add(vu_A, Bank::CHANGE_ADDRESS); - bank.add(mute_A, Bank::CHANGE_ADDRESS); - bank.add(solo_A, Bank::CHANGE_ADDRESS); - bank.add(recrdy_A, Bank::CHANGE_ADDRESS); - - bank.add(ring_B, Bank::CHANGE_ADDRESS); - bank.add(vu_B, Bank::CHANGE_ADDRESS); - bank.add(mute_B, Bank::CHANGE_ADDRESS); - bank.add(solo_B, Bank::CHANGE_ADDRESS); - bank.add(recrdy_B, Bank::CHANGE_ADDRESS); - - initializeDisplay(); // Start the OLED display - - Control_Surface.begin(); // Initialize Control Surface -} - -/* ---------- Loop ----------- */ -/* =========================== */ - -void loop() { - Control_Surface.refresh(); // Refresh all elements -} diff --git a/examples.old/very-old/examples.h b/examples.old/very-old/examples.h deleted file mode 100644 index dd4137319e..0000000000 --- a/examples.old/very-old/examples.h +++ /dev/null @@ -1,402 +0,0 @@ -/** - * @example Ex.04.Switch.ino - * - * This is an example of the DigitalLatch class of the Control_Surface library. - * - * Connect a toggle switch to digital pin 2. Connect the other pin of the switch to the ground, - * a pull-up resistor is not necessary, because the internal one will be used. - * The switch will briefly play MIDI note C4 when flipped. - * Map it in your DAW or DJ software. - * - * Written by tttapa, 08/09/2017 - * https://github.com/tttapa/Control-Surface -*/ - -/** - * @example Ex.16.ProgramSelector.ino - * - * This is an example of the ProgramSelector class of the Control_Surface library. - * - * Connect two push buttons between pins 11 and 12 and ground, - * pull-up resistors are not necessary, because the internal ones will be used. - * - * When the buttons are pressed, the patch number changes (see Selector for - * more information and the use of different selecting modes), and a - * MIDI Program Change event is sent. - * - * Written by Pieter P, 11-04-2018 - * https://github.com/tttapa/Control-Surface -*/ - -/** - * @example Ex.01.Potentiometer.ino - * - * This is an example of the AnalogCC class of the Control_Surface library. - * - * Connect a potentiometer to analog pin A0. This will be the MIDI channel volume of channel 1. - * Map it in your DAW or DJ software. - * - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.05.HiRes-Potentiometer.ino - * - * This is an example of the AnalogPB class of the Control_Surface library. - * - * Connect a potentiometer to analog pin A0. It will send MIDI Pitch Bend messages on channel 1. - * Map it in your DAW or DJ software. - * - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.09.Bank-Calibrate.ino - * - * This is an example of the Bank class of the Control_Surface library. - * - * Connect two potentiometers to analog pins A0 and A1, - * and two pushbuttons to pins 2 and 3. - * - * Connect a toggle switch to pin 11. - * - * When the toggle switch is turned off: - * - Potentiometer A is channel volume of track 1   (Controller number 0x07, MIDI channel 1) - * - Potentiometer B is channel volume of track 2   (Controller number 0x07, MIDI channel 2) - * - Mute button A is the mute button for track 1   (Note number 0x10, MIDI channel 1) - * - Mute button B is the mute button for track 2   (Note number 0x11, MIDI channel 1) - * - * When the toggle switch is turned on: - * - Potentiometer A is channel volume of track 3   (Controller number 0x07, MIDI channel 3) - * - Potentiometer B is channel volume of track 4   (Controller number 0x07, MIDI channel 4) - * - Mute button A is the mute button for track 3   (Note number 0x12, MIDI channel 1) - * - Mute button B is the mute button for track 4   (Note number 0x13, MIDI channel 1) - * - * This allows you to control multiple tracks with only a limited amount of physical potentiometers and buttons - * - * Map accordingly in your DAW or DJ software. - * - * Set 'minimumValue' to the analog value read when the potentiometer is in the minimum position. - * Set 'maximumValue' to the analog value read when the potentiometer is in the maximum position. - * - * Note: It is recommended to use a BankSelector (See Ex.07.BankSelectors) instead of changing the bank setting manually. - * - * Written by Pieter P, 20-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.10.Debug-MIDI.ino - * - * This is an example of the debug functionality of the Control_Surface library. - * - * Connect a push buttons to digital pin 2. Connect the other pin of the button to the ground, - * a pull-up resistor is not necessary, because the internal one will be used. - * This button will play MIDI note C4 when pressed. - * - * Open the Serial Monitor in the Arduino IDE (CTRL+SHIFT+M) and press the button. - * You should see messages like: - * - * - Note On Channel: 1 Data 1: 0x3C Data 2: 0x7F - * - Note Off Channel: 1 Data 1: 0x3C Data 2: 0x7F - * - * You can also send MIDI messages in hexadecimal format: - * For example: `90 3C 7F` (note on, note 0x3C, velocity 0x7F) should turn on the built-in LED. - * `80 3C 7F` (note off, note 0x3C, velocity 0x7F) should turn off the built-in LED. - * - * Written by Pieter P, 20-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.12.AnalogMultiplex.ino - * - * This is an example of the AnalogMultiplex class of the Control_Surface library. - * - * Connect an analog multiplexer to analog pin A0. Connect the address lines to pins 2, 3 and 4. - * Connect 8 potentiometers to the inputs of the multiplexer. - * These will be the channel volumes - * of MIDI channels 1 through 8. - * Map accordingly in your DAW or DJ software. - * - * Written by Pieter P, 20-09-2017 - * https://github.com/tttapa/Control-Surface -*/ - -/** - * @example Ex.08.Potentiometer-Calibrate.ino - * - * This is an example of the AnalogCC and AnalogPB classes of the Control_Surface library. - * - * Connect a potentiometer to analog pin A0. This will be the MIDI channel volume of channel 1. - * - * Map it in your DAW or DJ software. - * - * Set 'minimumValue' to the analog value read when the potentiometer is in the minimum position. - * Set 'maximumValue' to the analog value read when the potentiometer is in the maximum position. - * - * Written by Pieter P, 20-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.07.BankSelectors.ino - * - * This is an example of the BankSelector class of the Control_Surface library. - * - * Connect two potentiometers to analog pins A0 and A1, - * and two pushbuttons to pins 2 and 3. - * - * Connect push buttons to pins 11 and 12, and 4 LEDs (+ current limiting resitors) to pins 4, 5, 6 and 7. - * - * When bank 1 is selected: - * - Potentiometer A is channel volume of track 1   (Controller number 0x07, MIDI channel 1) - * - Potentiometer B is channel volume of track 2   (Controller number 0x07, MIDI channel 2) - * - Mute button A is the mute button for track 1   (Note number 0x10, MIDI channel 1) - * - Mute button B is the mute button for track 2   (Note number 0x11, MIDI channel 1) - * - The LED on pin 4 lights up. - * - * When bank 2 is selected: - * - Potentiometer A is channel volume of track 3   (Controller number 0x07, MIDI channel 3) - * - Potentiometer B is channel volume of track 4   (Controller number 0x07, MIDI channel 4) - * - Mute button A is the mute button for track 3   (Note number 0x12, MIDI channel 1) - * - Mute button B is the mute button for track 4   (Note number 0x13, MIDI channel 1) - * - The LED on pin 5 lights up. - * - * When bank 3 is selected: - * - Potentiometer A is channel volume of track 5   (Controller number 0x07, MIDI channel 5) - * - Potentiometer B is channel volume of track 6   (Controller number 0x07, MIDI channel 6) - * - Mute button A is the mute button for track 5   (Note number 0x14, MIDI channel 1) - * - Mute button B is the mute button for track 6   (Note number 0x15, MIDI channel 1) - * - The LED on pin 6 lights up. - * - * When bank 4 is selected: - * - Potentiometer A is channel volume of track 7   (Controller number 0x07, MIDI channel 7) - * - Potentiometer B is channel volume of track 8   (Controller number 0x07, MIDI channel 8) - * - Mute button A is the mute button for track 7   (Note number 0x16, MIDI channel 1) - * - Mute button B is the mute button for track 8   (Note number 0x17, MIDI channel 1) - * - The LED on pin 7 lights up. - * - * This allows you to control multiple tracks with only a limited amount of physical potentiometers and buttons - * - * Map accordingly in your DAW or DJ software. - * - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface -*/ - -/** - * @example Ex.06.Banks.ino - * - * This is an example of the Bank class of the Control_Surface library. - * - * Connect two potentiometers to analog pins A0 and A1, - * and two pushbuttons to pins 2 and 3. - * - * Connect a toggle switch to pin 11. - * - * When the toggle switch is turned off: - * - Potentiometer A is channel volume of track 1 (Controller number 0x07, MIDI channel 1) - * - Potentiometer B is channel volume of track 2 (Controller number 0x07, MIDI channel 2) - * - Mute button A is the mute button for track 1 (Note number 0x10, MIDI channel 1) - * - Mute button B is the mute button for track 2 (Note number 0x11, MIDI channel 1) - * - * When the toggle switch is turned on: - * - Potentiometer A is channel volume of track 3 (Controller number 0x07, MIDI channel 3) - * - Potentiometer B is channel volume of track 4 (Controller number 0x07, MIDI channel 4) - * - Mute button A is the mute button for track 3 (Note number 0x12, MIDI channel 1) - * - Mute button B is the mute button for track 4 (Note number 0x13, MIDI channel 1) - * - * This allows you to control multiple tracks with only a limited amount of physical potentiometers and buttons - * - * Map accordingly in your DAW or DJ software. - * - * Note: It is recommended to use a BankSelector (See Ex.07.BankSelectors.ino) instead of changing the bank setting manually. - * - * ### How it works: - @par - When the bank setting is set to 1, - - 2 (i.e. the number of tracks per bank) will be added to the channel number of the potentiometers. - This is because they were added to the bank using the CHANGE_CHANNEL mode. - - 2 (i.e. the number of tracks per bank) will be added to the note numbers of the buttons. - This is because they were added to the bank using the CHANGE_ADDRESS mode; - - - ### In general: - @par - For controls that were added using the CHANGE_ADDRESS mode: - - The address will be: startAddress + tracksPerBank * bankSetting - - The channel won't change. - @par - For controls that were added using the CHANGE_CHANNEL mode: - - The channel will be: startChannel + tracksPerBank * bankSetting - - The address won't change. - - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.13.Shift-Register.ino - * - * This is an example of the ShiftRegisterOut class of the Control_Surface library. - * - * Connect a potentiometer to analog pins A0. - * Connect push buttons to pins 2 and 3, and a shift register to pins 10 (ST_CP), 11 (DS) and 13 (SH_CP). - * Connect LEDs (+ current limiting resistors) to the 8 outputs of the shift register. - * - * Pins 2 and 3 increment or decrement the bank setting, and the LEDs display the bank setting. - * - * This allows you to control multiple tracks with only a limited amount of physical potentiometers and buttons. - * - * Depending on the bank setting, the potentiometer will send MIDI Control Change - * as the channel volume of channels 1 through 8. - * Map accordingly in your DAW or DJ software. - * - * Written by Pieter P, 08-09-2017 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.02.Button.ino - * - * This is an example of the Digital class of the Control_Surface library. - * - * Connect a push buttons to digital pin 2. Connect the other pin of the button to the ground, - * a pull-up resistor is not necessary, because the internal one will be used. - * This button will play MIDI note C4 when pressed. - * Map it in your DAW or DJ software. - * - * Written by tttapa, 08/09/2017 - * https://github.com/tttapa/Control-Surface -*/ - -/** - * @example Ex.17.Transposer.ino - * - * @brief An example demonstrating the transpose function. - * - * Connect 8 buttons to pins 2 - 9, to use as piano keys - * and two buttons to pins 10 - 11 to transpose the notes. - * - * Pressing button 10 once raises the pitch by one semitone, - * if you press it again, the pitch is two semitones higher, etc. - * Pressing button 11 lowers the pitch by one semitone at a time. - * - * Written by Pieter P, 27-05-2018 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.14.LED.ino - * - * This is an example of the MIDI_LED class of the Control_Surface librar. - * - * Connect two push buttons to pins 2 and 3. Pull-up resistors are not necessary, - * because the internal ones will be used. - * Connect two LEDs (+ current limiting resistors) to pins 12 and 13. - * - * The buttons will mute and un-mute tracks 1 and 2 respectively. The LEDs will - * indicate whether the channel is muted or not. - * - * Configure as a MCU-compatible Control Surface (Mackie Control Universal) in your DAW. - * - * Written by Pieter P, 2018-04-11 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example OLED-Demo.ino - * - * An extensive example demonstrating the use of DisplayElement%s - * to display information from the DAW on a small OLED display. - * - * The example displays the cursor time location, play and record status, - * and for each of the 8 first tracks, it displays: - * mute, solo, record ready, pan, and VU level meter with peak indicator. - * - * @image html "OLED-Demo.png" - * - * Using a BankSelector, it displays two channels at once, and you can - * cycle through four banks to display all 8 tracks. - * - * There are two rotary encoders that control the pan of the selected - * tracks, two mute, solo, record, and select buttons for the tracks, - * and a play and record button. - */ - -/** - * @example Ex.03.Rotary-Encoder.ino - * - * This is an example of the RotaryEncoder class of the Control_Surface library. - * - * Connect the A and B pins of the encoder to 2 interrupt pins (2 and 3). - * It's recommended to use 100nF capacitors between the A and B pins and ground (hardware debounce). - * Connect the common (C) pin to the ground. Pull-up resistors are not necessary, since the internal ones will be used. - * Map the control change message 0x14 to the right control in your DJ or DAW software, - * and select 'relative' instead of 'absolute'. - * - * If you are using a jog wheel, use JOG, if you are using a normal encoder - * (for normal controls like EQ or volume etc.) use NORMAL_ENCODER. - * If you have strange results in your software, try a different relative mode: - * TWOS_COMPLEMENT, BINARY_OFFSET or SIGN_MAGNITUDE. - * If the control works, but it goes in the wrong direction, swap the pins A and B of the encoder - * (either physically, or by swapping the pin numbers in the RotaryEncoder constructor). - * - * Written by Pieter P, 22-08-2017 - * https://github.com/tttapa/Control-Surface -*/ - -/** - * @example Ex.15.LED-Shift-Register.ino - * - * This is an example of the ShiftRegisterOut class of the Control_Surface library. - * - * Connect three daisy-chained shift registers to pins 11 (ST_CP), 12 (DS) and 10 (SH_CP). - * Connect 8 RGB LEDs (+ current limiting resistors) to the outputs of the shift registers - * (R-G-B-R-G-B-...). - * If blue LEDs light up when red ones should, either flip all the LEDs, or change the - * bit order in the ShiftRegisterOut constructor to 'MSBFIRST' instead fo 'LSBFIRST'. - * - *
- * 10 >──────────────┬─────────────────────────────┬─────────────────────────────┐            
- *        ┏━━━━━━━━━━┷━━━━━━━━━━━┓      ┏━━━━━━━━━━┷━━━━━━━━━━━┓      ┏━━━━━━━━━━┷━━━━━━━━━━━┓
- *        ┃        SH_CP         ┃      ┃        SH_CP         ┃      ┃        SH_CP         ┃
- * 12 >───┨ Data in     Data out ┠──────┨ Data in     Data out ┠──────┨ Data in     Data out ┃
- *        ┃        ST_CP         ┃      ┃        ST_CP         ┃      ┃        ST_CP         ┃
- *        ┗━━━━━━━━━━┯━━━━━━━━━━━┛      ┗━━━━━━━━━━┯━━━━━━━━━━━┛      ┗━━━━━━━━━━┯━━━━━━━━━━━┛
- * 11 >──────────────┴─────────────────────────────┴─────────────────────────────┘            
- * 
- * - * The 8 LEDs represent 8 channels. A red LED indicates that the channel is muted, - * a green LED indicates that solo is enabled, and a blue LED indicates that the - * channel is armed for recording. - * - * Configure as a MCU-compatible Control Surface (Mackie Control Universal) in your DAW. - * - * Written by Pieter P, 22-03-2018 - * https://github.com/tttapa/Control-Surface - */ - -/** - * @example Ex.11.Button-Matrix.ino - * - * This is an example of the ButtonMatrix class of the Control_Surface library. - * - * Connect a 4 × 3 matrix of buttons with the rows to pins 2, 3, 4 and 5, - * and the columns to pins 6, 7 and 8. - * Pull-up resistors are not necessary, because the internal ones will be used. - * - * If you want to be able to press multiple buttons at once, add a diode - * in series with each button, as shown in the following schematic: - * - * @image html Button-matrix.svg - * - * The note numbers are specified in the `addresses` array. - * Map accordingly in your DAW or DJ software. - * - * Written by tttapa, 24/09/2017 - * https://github.com/tttapa/Control-Surface -*/