Last Updated or created 2025-06-24
I bought a teensyrom a while ago.
Tyrone and I wanted to control the settings using potmeters.
So I grabbed a Teensy 4.1 controller and some 10K potmeters, some code using
Test code for two pots, don’t forget to set your USB mode to midi!
Schematic soon, also all tweaks and note sending.
Next to do: 12 pots!
A nice case and extra buttons!
reconst int numPots = 12; // Custom mappings: const int potPins[numPots] = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11}; // Analog pins const int ccNumbers[numPots] = {4, 8, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; // CC numbers const int midiChannels[numPots]= {2, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4}; // MIDI channels (1–16) int lastValues[numPots]; void setup() { for (int i = 0; i < numPots; i++) { pinMode(potPins[i], INPUT); lastValues[i] = -1; } } void loop() { for (int i = 0; i < 2; i++) { int analogValue = analogRead(potPins[i]); int midiValue = analogValue / 8; // Scale 0–1023 to 0–127 if (abs(midiValue - lastValues[i]) > 1) { usbMIDI.sendControlChange(ccNumbers[i], midiValue, midiChannels[i]); lastValues[i] = midiValue; } } delay(5); }