step by step build up
![](https://turboflip.de/wp-content/uploads/2024/05/Screenshot-2024-06-07-100927-1024x825.png)
Now lets flicker the matrix first 🙂
#define PIN_DIN 8 #define PIN_CLK 9 #define PIN_CS 10 #define NUM_DEVICES 1 #include <LedControl.h> LedControl lc = LedControl(PIN_DIN, PIN_CLK, PIN_CS, NUM_DEVICES); void setup() { lc.shutdown(0, false); // intensity level (0..15) lc.setIntensity(0, 15); lc.clearDisplay(0); } void loop() { int rx = (int)(random(8)); int ry = (int)(random(8)); if (random(100) > 50) { lc.setLed(0, rx, ry, true); } else { lc.setLed(0, rx, ry, false); } }
two potentiometers and one cursor
#define PIN_DIN 8 #define PIN_CLK 9 #define PIN_CS 10 #define NUM_DEVICES 1 #include <LedControl.h> LedControl lc = LedControl(PIN_DIN, PIN_CLK, PIN_CS, NUM_DEVICES); void setup() { lc.shutdown(0, false); // intensity level (0..15) lc.setIntensity(0, 15); lc.clearDisplay(0); } void loop() { // read out both analog Pins from the potis int poti_1_in = analogRead(1); // values from 0 to 1024 int poti_2_in = analogRead(2); // values from 0 to 1024 // map the poti value to the matrix size int cx = int( map(poti_1_in, 0, 1024, 0,8 )); int cy = int( map(poti_2_in, 0, 1024, 0,8 )); // int cx = int(poti_1_in/128); // clear matrix and draw cursor lc.clearDisplay(0); lc.setLed(0,cx, cy, true); }
two potentiometers and one cursor now MIDIFIED 🙂
![](https://turboflip.de/wp-content/uploads/2024/05/Screenshot-2024-06-07-115642.png)
#define PIN_DIN 8 #define PIN_CLK 9 #define PIN_CS 10 #define NUM_DEVICES 1 #include <LedControl.h> LedControl lc = LedControl(PIN_DIN, PIN_CLK, PIN_CS, NUM_DEVICES); #include "MIDIUSB.h" void setup() { lc.shutdown(0, false); // intensity level (0..15) lc.setIntensity(0, 15); lc.clearDisplay(0); } void loop() { // read out both analog Pins from the potis int poti_1_in = analogRead(1); // values from 0 to 1024 int poti_2_in = analogRead(2); // values from 0 to 1024 // map the poti value to the matrix size int cx = int( map(poti_1_in, 0, 1024, 0,8 )); int cy = int( map(poti_2_in, 0, 1024, 0,8 )); // clear matrix and draw cursor lc.clearDisplay(0); lc.setLed(0,cx, cy, true); controlChange(0, 4, poti_1_in/8); // Set the value of controller 10 on channel 0 to a random value controlChange(0, 5, poti_2_in/8); // Set the value of controller 10 on channel 0 to a random value MidiUSB.flush(); delay(10); } // ------------------------------------------------- // -------------MIDI CODE - DO NOT TOUCH ----------- // ------------------------------------------------- void controlChange(byte channel, byte control, byte value) { midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value}; MidiUSB.sendMIDI(event); }
DOWNLOAD PD PATCH: basic_two_osc_synth