A warm hello in the round,
i´m Axel and i´m verry new on microcontroller and i have fineshed my first Project. I have build a small Mdi controller with 7 Pots and a led for showing the status of Power on/off. It works verry well but i have a Problem on a special point and i hope for a little help on this place
It seems that my Potiometers sending every time midi singnals. This is if i solder (or test on breadboard) more than 2 Pots. After a time my PC DAW tells my that to many Midi data is incoming. You can see that the signals a flicker and not constant. The informations i found in the net are that all componets are sending signals. More Components more Signals I have found that i do must make a smoothing on my code that smooth the Potiometers. But i do not found some code examples. So... can you help my please?
Thats my Code based on Midi Elements libery by TomashG HZ:
I use a Teensy 3.2. Soldering is dirctliy from Teensy 3.2 to Poti. And than from GRND, Data, +from Poti to Poti
Software was used the last Arduino Soft on Win10.
Thanks a lot and sorry for my rough english !
Greats
Axel
i´m Axel and i´m verry new on microcontroller and i have fineshed my first Project. I have build a small Mdi controller with 7 Pots and a led for showing the status of Power on/off. It works verry well but i have a Problem on a special point and i hope for a little help on this place
It seems that my Potiometers sending every time midi singnals. This is if i solder (or test on breadboard) more than 2 Pots. After a time my PC DAW tells my that to many Midi data is incoming. You can see that the signals a flicker and not constant. The informations i found in the net are that all componets are sending signals. More Components more Signals I have found that i do must make a smoothing on my code that smooth the Potiometers. But i do not found some code examples. So... can you help my please?
Thats my Code based on Midi Elements libery by TomashG HZ:
Code:
// MIDI Elements empty template
// by Tomash Ghz
// www.tomashg.com
// ghz.tomash@gmail.com
#include <MIDIElements.h>
const int ledPinDig = 13;
boolean debug = false; // print to serial instead of midi
boolean secondary = true; // enable secondary midi messages
int midiChannel = 1; // midi channel number
// pins used in this exapmle are ones in corner of board, so:
// 11 & 12 for Teensy 3.x
// 16 & 17 for Teensy 2.0++
//int butPin1 = 11; // digital pin for reading first button
//int butPin2 = 12; // digital pin for reading second button
int potPin = A0; // analog pin A7 for Teensy 3.x, for Teensy 2.0++ change this to 45
int potPin1 = A1; // analog pin A7 for Teensy 3.x, for Teensy 2.0++ change this to 45
int potPin2 = A2; // analog pin A7 for Teensy 3.x, for Teensy 2.0++ change this to 45
int potPin3 = A3; // analog pin A7 for Teensy 3.x, for Teensy 2.0++ change this to 45
int potPin4 = A4; // analog pin A7 for Teensy 3.x, for Teensy 2.0++ change this to 45
int potPin5 = A5; // analog pin A7 for Teensy 3.x, for Teensy 2.0++ change this to 45
int potPin6 = A6; // analog pin A7 for Teensy 3.x, for Teensy 2.0++ change this to 45
int ledPin = 3; // PWM pin 3 for Teensy 3.x, for Teensy 2.0++ change this to 15
// declare all your components here
//Button but(butPin1, midiChannel, 1, secondary, debug); // button 1 on pin 17
//Button but2(butPin2, midiChannel, 2, secondary, debug); // button 2 on pin 16
Potentiometer pot(potPin, midiChannel, 20, secondary, debug); // knob on pin 45 (A7)
Potentiometer pot1(potPin1, midiChannel, 21, secondary, debug); // knob on pin 45 (A7)
Potentiometer pot2(potPin2, midiChannel, 22, secondary, debug); // knob on pin 45 (A7)
Potentiometer pot3(potPin3, midiChannel, 23, secondary, debug); // knob on pin 45 (A7)
Potentiometer pot4(potPin4, midiChannel, 24, secondary, debug); // knob on pin 45 (A7)
Potentiometer pot5(potPin5, midiChannel, 25, secondary, debug); // knob on pin 45 (A7)
Potentiometer pot6(potPin6, midiChannel, 26, secondary, debug); // knob on pin 45 (A7)
Led led(ledPin, midiChannel, 3, true); // led on pin 15 with PWM enabled, triggered on the same CC number as pot
void setup()
{
pinMode(ledPinDig, OUTPUT);
usbMIDI.setHandleNoteOff(OnNoteOff); //set event handler for note off
usbMIDI.setHandleNoteOn(OnNoteOn); //set event handler for note on
usbMIDI.setHandleControlChange(OnControlChange); // set event handler for CC
}
void loop()
{
// add here all the input component reads
digitalWrite(ledPinDig, HIGH);
pot.read(); // read knob and send midi messages
pot1.read(); // read knob and send midi messages
pot2.read(); // read knob and send midi messages
pot3.read(); // read knob and send midi messages
pot4.read(); // read knob and send midi messages
pot5.read(); // read knob and send midi messages
pot6.read(); // read knob and send midi messages
//but.read(); // read buttons and send midi messages
//but2.read();
usbMIDI.read(); // read all the incoming midi messages
}
//====================================================================
// event handlers
void OnNoteOn(byte channel, byte note, byte velocity)
{
// add all your output component sets that will trigger with note ons
led.setOn(channel, note, velocity);
}
void OnNoteOff(byte channel, byte note, byte velocity)
{
// add all your output component sets that will trigger with note ons
led.setOff(channel, note, velocity);
}
void OnControlChange(byte channel, byte control, byte value)
{
// add all your output component sets that will trigger with cc
led.setOn(channel, control, value);
}
I use a Teensy 3.2. Soldering is dirctliy from Teensy 3.2 to Poti. And than from GRND, Data, +from Poti to Poti
Software was used the last Arduino Soft on Win10.
Thanks a lot and sorry for my rough english !
Greats
Axel