iamtritium
New member
hello, new to all this and i have been poking around.
Initially Arduino IDE was not showing teensy boards even after installing Teensyduino.
Deleted everything and started from scratch. everything is peachy.
I have the soldering down, but im new to coding.
Downloaded two codes and tested them separately. they both work exactly how i wanted them to.
i am using two slide switches and one potentiometer. however i have tried to combine them and im not having luck.
i am posting them separately...
can someone help me combine them properly.
first switch sends signal CH05.CC.01 which is what i wanted. it only outputs one signal. so in the program i am using. i have it mapped to two buttons with an invert on the second so it acts like a toggle between the two. (so wheres CH05.CC.02?)
if i flip the second switch it changes the output of the first switch to NOTEs. however i would like for the second switch to work like the first and send CH05CC.02
the potentiometer works perfect when that code alone is in the teensy.
i want to fix and combine both codes.
at least combine them.. i can work with the second output being notes if anything.
thank you for any help and encouragement.
Initially Arduino IDE was not showing teensy boards even after installing Teensyduino.
Deleted everything and started from scratch. everything is peachy.
I have the soldering down, but im new to coding.
Downloaded two codes and tested them separately. they both work exactly how i wanted them to.
i am using two slide switches and one potentiometer. however i have tried to combine them and im not having luck.
i am posting them separately...
#include <ResponsiveAnalogRead.h> const int pot_pin = A0; // pot input int potValue; // Stores Pot State int potMidiValue; // Stores Pot State devided by 8 for MIDI int conNum; // midi cc control number int carryVal = 0; ResponsiveAnalogRead analog(pot_pin, true); void setup() { Serial.begin(9600); } void loop() { analog.update(); //update the analouge reading in each pass potValue = analog.getValue(); // store current state in variable potMidiValue = potValue / 8; // Makes potVale in to MIDI friendly code if ((analog.hasChanged()) && (potMidiValue != carryVal)){ usbMIDI.sendControlChange(conNum, potMidiValue, 5); Serial.println(potMidiValue); } carryVal = potMidiValue; while (usbMIDI.read()) { } delay(5); } |
..................................................................... #include <Bounce.h> const int NUM_OF_BUTTONS = 2; const int MIDI_CHAN = 5; const int DEBOUNCE_TIME = 5; Bounce buttons[NUM_OF_BUTTONS] = { Bounce (0, DEBOUNCE_TIME), Bounce (1, DEBOUNCE_TIME) }; const int MIDI_MODE_NOTES = 0; const int MIDI_MODE_CCS = 1; int midiMode = MIDI_MODE_NOTES; const int MIDI_NOTE_NUMS[NUM_OF_BUTTONS] = {40, 41}; const int MIDI_NOTE_VELS[NUM_OF_BUTTONS] = {110, 110}; const int MIDI_CC_NUMS[NUM_OF_BUTTONS] = {01, 02}; const int MIDI_CC_VALS[NUM_OF_BUTTONS] = {127, 127}; void setup() { for (int i = 0; i < NUM_OF_BUTTONS + 1; i++) { pinMode (i, INPUT_PULLUP); } } void loop() { for (int i = 0; i < NUM_OF_BUTTONS + 1; i++) { buttons.update(); } for (int i = 0; i < NUM_OF_BUTTONS; i++) { if (buttons[i + 1].fallingEdge()) { if (midiMode == MIDI_MODE_NOTES) usbMIDI.sendNoteOn (MIDI_NOTE_NUMS, MIDI_NOTE_VELS, MIDI_CHAN); else usbMIDI.sendControlChange (MIDI_CC_NUMS, MIDI_CC_VALS, MIDI_CHAN); } else if (buttons[i + 1].risingEdge()) { if (midiMode == MIDI_MODE_NOTES) usbMIDI.sendNoteOff (MIDI_NOTE_NUMS, 0, MIDI_CHAN); else usbMIDI.sendControlChange (MIDI_CC_NUMS, 0, MIDI_CHAN); } } if (buttons[0].fallingEdge()) { midiMode = MIDI_MODE_NOTES; } else if (buttons[0].risingEdge()) { midiMode = MIDI_MODE_CCS; } while (usbMIDI.read()) { } } |
can someone help me combine them properly.
first switch sends signal CH05.CC.01 which is what i wanted. it only outputs one signal. so in the program i am using. i have it mapped to two buttons with an invert on the second so it acts like a toggle between the two. (so wheres CH05.CC.02?)
if i flip the second switch it changes the output of the first switch to NOTEs. however i would like for the second switch to work like the first and send CH05CC.02
the potentiometer works perfect when that code alone is in the teensy.
i want to fix and combine both codes.
at least combine them.. i can work with the second output being notes if anything.
thank you for any help and encouragement.