Midi and system stability problem

Sbrebbaz

New member
Hi everyone,
I've built and programmed a midi contreller with a teensy ++ 2.0. to control the parameters on VCV rack. I' m finding some problems with the stability. The controller has a double function. The first concerns the use of 16 potentiometers, 5 faders, 2 push button and an oled screen to print all the value of each component. The second one instead concerns the use 8 encoders activated by the push button of one of them and which stops the working of all the components written above to allow the use of the encoders theirselves, cause none is connected to the teensy via Interrupt Pin due the lack of Pin on the microcontreller, so I've decided to separate the functionabilty which would otherwise be compromised by the simultaneous use of OLED and encoders. The controller works fine this way but sometimes when I switch between the 2 functions all the system crashes forcing myself to unplug and re-plug the controller. I really don't know what the problem is with this dynamic, does anyone know what's going on and how to fix that?
I'll attach the code, I apologize in advance if it is not neat and optimized to the best.
 
Code:
void Fader_setup() {  
  pinMode(fad_PIN[n_fad], INPUT);
}

and

Code:
  pinMode(A0, INPUT);

You do not need to set the mode of analog pins. pinMode is only used to set the state of digital pins.
Fader_setup() wouldn't work anyway because it will try to set pin fad_PIN[5] which isn't defined.

Pete
 
Back
Top