Teensyduino USB MIDI Interface programming help please.

Building a 16 Button, 4 Knob and 4 Fader Midi Controller but cant get the CC Values for the pots to stay stable… they are constantly changing witch makes mapping impossible and the knobs in the DAW to jiggle or shake. Please note i am currently testing 1 knob and 1 button to get the code working, i am well aware it is incomplete

some code borrowed from DJTT

Thanks: Tapps :slight_smile:

Video of problem.

//Tapps' Teensy++ Midi Controller.
//
//Includes "Bounce Library" for Buttons.
#include <Bounce.h>
#define analogInputs 8

//Changing LED pin
int ledPin = 6; 

//Make arrays for input values and lagged input values
int inputAnalog[analogInputs];
int iAlag[analogInputs];

//Make array of cc values
int ccValue[analogInputs];

//Index variable for loop
int i;

//CC values for Buttons
int cc_off = 0;
int cc_on = 65;
int cc_super = 127;

//Map Buttons to CC
int cc0 = 24;
int cc1 = 25;
int cc2 = 26;
int cc3 = 27;
int cc4 = 28;
int cc5 = 29;
int cc6 = 30;
int cc7 = 31;

//Channel number for midi messages.
const int midiChannel = 3;

//"Bank 0".
int bank = 0; //Note: C-1

//Digital pins for buttons
int buttons[16]= {
  27, 3, 19, 23, //First row
   0, 4, 20, 24,
   1, 5, 21, 25,
   2, 6, 22, 26
};

//Bank buttons
int banks[4]= {
  11, 12, 13, 14
};

//Analog pins for knobs and faders.
int analog[8]= {
  A0, A1, A2, A3, A4, A5, A6, A7
};

//Buttons.
Bounce button0 = Bounce(27,5); //Pin27
Bounce button1 = Bounce(0,5); //Pin0
Bounce button2 = Bounce(1,5); //Pin1
Bounce button3 = Bounce(2,5); //Pin2
Bounce button4 = Bounce(3,5); //Pin3
Bounce button5 = Bounce(4,5); //Pin4
Bounce button6 = Bounce(5,5); //Pin5
Bounce button7 = Bounce(6,5); //Pin6
Bounce button8 = Bounce(19,5); //Pin19
Bounce button9 = Bounce(20,5); //Pin20
Bounce button10 = Bounce(21,5); //Pin21
Bounce button11 = Bounce(22,5); //Pin22
Bounce button12 = Bounce(23,5); //Pin23
Bounce button13 = Bounce(24,5); //Pin24
Bounce button14 = Bounce(25,5); //Pin25
Bounce button15 = Bounce(26,5); //Pin26

//Banks.
Bounce bank0 = Bounce(11,5); //Pin11
Bounce bank1 = Bounce(12,5); //Pin12
Bounce bank2 = Bounce(13,5); //Pin13
Bounce bank3 = Bounce(14,5); //Pin14
 
//Extra buttons add if you want.. 
Bounce extra0 = Bounce(18, 5); //Pin18
Bounce extra1 = Bounce(17, 5); //Pin17
Bounce extra2 = Bounce(16, 5); //Pin16
Bounce extra3 = Bounce(15, 5); //Pin15
Bounce extra4 = Bounce(10, 5); //Pin10
Bounce extra5 = Bounce(9, 5); //Pin9
Bounce extra6 = Bounce(8, 5); //Pin8
Bounce extra7 = Bounce(7, 5); //Pin7

//Enables pullup resistors.
void setup() {
  Serial.begin(31250);
  pinMode(0, INPUT_PULLUP);  //Button1
  pinMode(1, INPUT_PULLUP);  //Button2
  pinMode(2, INPUT_PULLUP);  //Button3
  pinMode(3, INPUT_PULLUP);  //Button4
  pinMode(4, INPUT_PULLUP);  //Button5
  pinMode(5, INPUT_PULLUP);  //Button6
  pinMode(6, OUTPUT);  //Button7
  pinMode(7, INPUT_PULLUP);  //Extra0
  pinMode(8, INPUT_PULLUP);  //Extra1
  pinMode(9, INPUT_PULLUP);  //Extra2
  pinMode(10, INPUT_PULLUP); //Extra3
  pinMode(11, INPUT_PULLUP); //Bank0
  pinMode(12, INPUT_PULLUP); //Bank1
  pinMode(13, INPUT_PULLUP); //Bank2
  pinMode(14, INPUT_PULLUP); //Bank3
  pinMode(15, INPUT_PULLUP); //Extra4
  pinMode(16, INPUT_PULLUP); //Extra5
  pinMode(17, INPUT_PULLUP); //Extra6
  pinMode(18, INPUT_PULLUP); //Extra7
  pinMode(19, INPUT_PULLUP); //Button15
  pinMode(20, INPUT_PULLUP); //Button14
  pinMode(21, INPUT_PULLUP); //Button13
  pinMode(22, INPUT_PULLUP); //Button12
  pinMode(23, INPUT_PULLUP); //Button11
  pinMode(24, INPUT_PULLUP); //Button10
  pinMode(25, INPUT_PULLUP); //Button9
  pinMode(26, INPUT_PULLUP); //Button8
  pinMode(27, INPUT_PULLUP); //Button0
};

void loop() {
  
  //Sets LED PIN off
  digitalWrite( ledPin, LOW);
  
  // loop trough active inputs for knobs
  for (i=0;i<analogInputs;i++){
    // read current value at i-th input
    inputAnalog[i] = analogRead(i);
    // if magnitude of difference is 8 or more...
    if (abs(inputAnalog[i] - iAlag[i]) > 7){
      // calc the CC value based on the raw value
      ccValue[i] = inputAnalog[i]/8;
      // send the MIDI
      usbMIDI.sendControlChange(i, ccValue[i], 3);
      // set raw reading to lagged array for next comparison
    }
  delay(10); // limits MIDI messages to reasonable number
  }
  
//Update Buttons.
button0.update(); //Button 0
button1.update(); //Button 1
button2.update(); //Button 2
button3.update(); //Button 3
button4.update(); //Button 4
button5.update(); //Button 5
button6.update(); //Button 6
button7.update(); //Button 7
button8.update(); //Button 15
button9.update(); //Button 14
button10.update(); //Button 13
button11.update(); //Button 12
button12.update(); //Button 11
button13.update(); //Button 10
button14.update(); //Button 9
button15.update(); //Button 8

//Update Banks
bank0.update(); //Bank0
bank1.update(); //Bank1
bank2.update(); //Bank2
bank3.update(); //Bank3

//Update Extras
extra0.update(); //Extra0
extra1.update(); //Extra1
extra2.update(); //Extra2
extra3.update(); //Extra3
extra4.update(); //Extra4
extra5.update(); //Extra5
extra6.update(); //Extra6
extra7.update(); //Extra7

//Tells Teensy++ to hold a bank until next bank is pressed.
  if (bank0.fallingEdge()) {
   bank = 1;
 }

  if (bank1.fallingEdge()) {
    bank = 2;
 }

  if (bank2.fallingEdge()) {
    bank = 3;
 }
  if (button0.fallingEdge()) {
    usbMIDI.sendNoteOn(8 + bank * 16, 127, midiChannel); //C1 = 24
  }
  //else (button0.fallingEdge()); {
  //usbMIDI.sendNoteOn(24 + bank * 16, 127, midiChannel);
  //}

//This section of code causes Note C0 (C Zero) to be constantly played? any ideas??

  
  if (button0.risingEdge()); {
    usbMIDI.sendNoteOff(8 + bank * 16, 127, midiChannel);
  }
  
  while (usbMIDI.read()); {
  }
}

You don't appear to be saving the previously read values to the iAlag array so the attempt at introducing hysteresis comes to nothing.

UKHeliBob: You don't appear to be saving the previously read values to the iAlag array so the attempt at introducing hysteresis comes to nothing.

thanks for the quick reply, this section of code was some of the borrowed code from DJTT (witch causes ableton to crash if "teensy midi" is selected for output.) so not surprising that it does not work correctly. thanks for the tip though as i am rather new to coding in general any push in the right direction is a good one :D

ok so i guess i missed a line in the code but that is still not solving the problem of unstable CC values, i don’t have to touch anything any the DAW is going crazy trying to figure out what is what…

i have also tried doing some research in to saving the previous state of an analog signal, but most of the articles i have come across are of no help to a noob for this particular problem…
Along with being a noob to coding im not really sure how arrays work all that well so troubleshooting it is rather hard on my own…

Updated hunk of code with missing string at the bottom:

  // loop trough active inputs for knobs
  for (i=0;i<analogInputs;i++){
    // read current value at i-th input
    inputAnalog[i] = analogRead(i);
    // if magnitude of difference is 8 or more...
    if (abs(inputAnalog[i] - iAlag[i]) > 7){
      // calc the CC value based on the raw value
      ccValue[i] = inputAnalog[i]/8;
      // send the MIDI
      usbMIDI.sendControlChange(i, ccValue[i], 3);
      // set raw reading to lagged array for next comparison
      iAlag[i] = inputAnalog[i];
    }
  delay(10); // limits MIDI messages to reasonable number
  }

i don’t have to touch anything any the DAW is going crazy

The Digital to Analog Whatever?

PaulS: The Digital to Analog Whatever?

Sorry i should have been more clear with the acronym, Digital Audio Workstation, when you go to midi map a component (e.g. knob or fader) the controller must send a MIDI note or CC value to clarify what component you are mapping with the audio workstation.

If you haven't noticed, we don't deal with "updated hunk of code"s here. We expect to see ALL of your code.

no i hadn’t noticed… if you hadn’t noticed this is my 8th post on the forums…

RobTapps:
… are of no help to a noob for this particular problem…
Along with being a noob to coding im not really sure how arrays work all that well so troubleshooting it is rather hard on my own…

//Tapps' Teensy++ Midi Controller.
//
//Includes "Bounce Library" for Buttons.
#include <Bounce.h>
#define analogInputs 8

//TESTING AREA START//



//TESTING AREA END//

//Changing LED pin
int ledPin = 6; 

//Initiate channel number for midi messages.
int midiChannel = 3;

//Make arrays for input values and lagged input values
int inputAnalog[analogInputs];
int iAlag[analogInputs];

//Make array of cc values
int ccValue[analogInputs];

//Index variable for loop
int i;

//CC values for Buttons
int cc_off = 0;
int cc_on = 65;
int cc_super = 127;

//Map Buttons to CC
int cc0 = 24;
int cc1 = 25;
int cc2 = 26;
int cc3 = 27;
int cc4 = 28;
int cc5 = 29;
int cc6 = 30;
int cc7 = 31;
int cc8 = 32;
int cc9 = 33;
int cc10 = 34;
int cc11 = 35;
int cc12 = 36;
int cc13 = 37;
int cc14 = 38;
int cc15 = 39;

//Map Bank Buttons to CC
int cc16 = 40;
int cc17 = 41;
int cc18 = 42;
int cc19 = 43;

//Map Extra buttons to CC
int cc20 = 44;
int cc21 = 45;
int cc22 = 46;
int cc23 = 47;
int cc24 = 48;
int cc25 = 49;
int cc26 = 50;


//Initiate "Bank 0".
//int bank = 0; //Note: C-1

//Initiate pins for use
//Digital pins for buttons
int buttons[16]= {
  27, 3, 19, 23, //First row
   0, 4, 20, 24,
   1, 5, 21, 25,
   2, 6, 22, 26
};

//Initiate bank buttons
int banks[4]= {
  11, 12, 13, 14
};

//Initiates Analog pins for knobs and faders.
int analog[8]= {
  A0, A1, A2, A3, A4, A5, A6, A7
};

//Buttons.
Bounce button0 = Bounce(27,5); //Pin27
Bounce button1 = Bounce(0,5); //Pin0
Bounce button2 = Bounce(1,5); //Pin1
Bounce button3 = Bounce(2,5); //Pin2
Bounce button4 = Bounce(3,5); //Pin3
Bounce button5 = Bounce(4,5); //Pin4
Bounce button6 = Bounce(5,5); //Pin5
Bounce button7 = Bounce(6,5); //Pin6
Bounce button8 = Bounce(19,5); //Pin19
Bounce button9 = Bounce(20,5); //Pin20
Bounce button10 = Bounce(21,5); //Pin21
Bounce button11 = Bounce(22,5); //Pin22
Bounce button12 = Bounce(23,5); //Pin23
Bounce button13 = Bounce(24,5); //Pin24
Bounce button14 = Bounce(25,5); //Pin25
Bounce button15 = Bounce(26,5); //Pin26

//Banks.
Bounce bank0 = Bounce(11,5); //Pin11
Bounce bank1 = Bounce(12,5); //Pin12
Bounce bank2 = Bounce(13,5); //Pin13
Bounce bank3 = Bounce(14,5); //Pin14
 
//Extra buttons add if you want.. 
Bounce extra0 = Bounce(18, 5); //Pin18
Bounce extra1 = Bounce(17, 5); //Pin17
Bounce extra2 = Bounce(16, 5); //Pin16
Bounce extra3 = Bounce(15, 5); //Pin15
Bounce extra4 = Bounce(10, 5); //Pin10
Bounce extra5 = Bounce(9, 5); //Pin9
Bounce extra6 = Bounce(8, 5); //Pin8
Bounce extra7 = Bounce(7, 5); //Pin7

//Enables pullup resistors.
void setup() {
  
  Serial.begin(9600);
  Serial.begin(31250);
  
  //TESTING AREA START//



  //TESTING AREA END//
 
  pinMode(0, INPUT_PULLUP);  //Button1
  pinMode(1, INPUT_PULLUP);  //Button2
  pinMode(2, INPUT_PULLUP);  //Button3
  pinMode(3, INPUT_PULLUP);  //Button4
  pinMode(4, INPUT_PULLUP);  //Button5
  pinMode(5, INPUT_PULLUP);  //Button6
  pinMode(6, OUTPUT);  //Button7
  pinMode(7, INPUT_PULLUP);  //Extra0
  pinMode(8, INPUT_PULLUP);  //Extra1
  pinMode(9, INPUT_PULLUP);  //Extra2
  pinMode(10, INPUT_PULLUP); //Extra3
  pinMode(11, INPUT_PULLUP); //Bank0
  pinMode(12, INPUT_PULLUP); //Bank1
  pinMode(13, INPUT_PULLUP); //Bank2
  pinMode(14, INPUT_PULLUP); //Bank3
  pinMode(15, INPUT_PULLUP); //Extra4
  pinMode(16, INPUT_PULLUP); //Extra5
  pinMode(17, INPUT_PULLUP); //Extra6
  pinMode(18, INPUT_PULLUP); //Extra7
  pinMode(19, INPUT_PULLUP); //Button15
  pinMode(20, INPUT_PULLUP); //Button14
  pinMode(21, INPUT_PULLUP); //Button13
  pinMode(22, INPUT_PULLUP); //Button12
  pinMode(23, INPUT_PULLUP); //Button11
  pinMode(24, INPUT_PULLUP); //Button10
  pinMode(25, INPUT_PULLUP); //Button9
  pinMode(26, INPUT_PULLUP); //Button8
  pinMode(27, INPUT_PULLUP); //Button0
};

void loop() {
  
  //TESTING AREA START//



  //TESTING AREA END//

  //Sets LED PIN off
  digitalWrite(ledPin, LOW);
  
  // loop trough active inputs for knobs
  for (i=0;i<analogInputs;i++){
    // read current value at i-th input
    inputAnalog[i] = analogRead(i);
    // if magnitude of difference is 8 or more...
    if (abs(inputAnalog[i] - iAlag[i]) > 7){
      // calc the CC value based on the raw value
      ccValue[i] = inputAnalog[i]/8;
      // send the MIDI
      usbMIDI.sendControlChange(i, ccValue[i], 3);
      // set raw reading to lagged array for next comparison
      iAlag[i] = inputAnalog[i];
    }
  delay(10); // limits MIDI messages to reasonable number
  }
  
//Update Buttons.
button0.update(); //Button 0
button1.update(); //Button 1
button2.update(); //Button 2
button3.update(); //Button 3
button4.update(); //Button 4
button5.update(); //Button 5
button6.update(); //Button 6
button7.update(); //Button 7
button8.update(); //Button 15
button9.update(); //Button 14
button10.update(); //Button 13
button11.update(); //Button 12
button12.update(); //Button 11
button13.update(); //Button 10
button14.update(); //Button 9
button15.update(); //Button 8

//Update Banks
bank0.update(); //Bank0
bank1.update(); //Bank1
bank2.update(); //Bank2
bank3.update(); //Bank3

//Update Extras
extra0.update(); //Extra0
extra1.update(); //Extra1
extra2.update(); //Extra2
extra3.update(); //Extra3
extra4.update(); //Extra4
extra5.update(); //Extra5
extra6.update(); //Extra6
extra7.update(); //Extra7

//Tells Teensy++ to hold a bank until next bank is pressed.
  //if (bank0.fallingEdge()) {
  // bank = 1;
// }

 // if (bank1.fallingEdge()) {
    //bank = 2;
// }

  //if (bank2.fallingEdge()) {
   // bank = 3;
// }
 
  if (button0.fallingEdge()) {
   usbMIDI.sendNoteOn(24, 127, midiChannel); //C1 = 24
  }
  if (button1.fallingEdge()) {
    usbMIDI.sendNoteOn(25, 127, midiChannel); //C1 = 24
  }
  if (button2.fallingEdge()) {
    usbMIDI.sendNoteOn(26, 127, midiChannel); //C1 = 24
  }
  if (button3.fallingEdge()) {
    usbMIDI.sendNoteOn(27, 127, midiChannel); //C1 = 24
  }
  if (button4.fallingEdge()) {
    usbMIDI.sendNoteOn(28, 127, midiChannel); //C1 = 24
  }
  if (button5.fallingEdge()) {
    usbMIDI.sendNoteOn(29, 127, midiChannel); //C1 = 24
  }
  if (button6.fallingEdge()) {
    usbMIDI.sendNoteOn(30, 127, midiChannel); //C1 = 24
  }
  if (button7.fallingEdge()) {
    usbMIDI.sendNoteOn(31, 127, midiChannel); //C1 = 24
  }
  if (button8.fallingEdge()) {
    usbMIDI.sendNoteOn(32, 127, midiChannel); //C1 = 24
  }
  if (button9.fallingEdge()) {
    usbMIDI.sendNoteOn(33, 127, midiChannel); //C1 = 24
  }
  if (button10.fallingEdge()) {
    usbMIDI.sendNoteOn(34, 127, midiChannel); //C1 = 24
  }
  if (button11.fallingEdge()) {
    usbMIDI.sendNoteOn(35, 127, midiChannel); //C1 = 24
  }
  if (button12.fallingEdge()) {
    usbMIDI.sendNoteOn(36, 127, midiChannel); //C1 = 24
  }
  if (button13.fallingEdge()) {
    usbMIDI.sendNoteOn(37, 127, midiChannel); //C1 = 24
  }
  if (button14.fallingEdge()) {
    usbMIDI.sendNoteOn(38, 127, midiChannel); //C1 = 24
  }
  if (button15.fallingEdge()) {
    usbMIDI.sendNoteOn(39, 127, midiChannel); //C1 = 24
  }
//------------------  
  if (button0.risingEdge()); {
   usbMIDI.sendNoteOff(24, 127, midiChannel);
 }
  if (button1.risingEdge()); {
   usbMIDI.sendNoteOff(25, 127, midiChannel);
 }
  if (button2.risingEdge()); {
   usbMIDI.sendNoteOff(26, 127, midiChannel);
 }
  if (button3.risingEdge()); {
   usbMIDI.sendNoteOff(27, 127, midiChannel);
 }
  if (button4.risingEdge()); {
   usbMIDI.sendNoteOff(28, 127, midiChannel);
 }
  if (button5.risingEdge()); {
   usbMIDI.sendNoteOff(29, 127, midiChannel);
 }
  if (button6.risingEdge()); {
   usbMIDI.sendNoteOff(30, 127, midiChannel);
 }
  if (button7.risingEdge()); {
   usbMIDI.sendNoteOff(31, 127, midiChannel);
 }
  if (button8.risingEdge()); {
   usbMIDI.sendNoteOff(32, 127, midiChannel);
 }
  if (button9.risingEdge()); {
   usbMIDI.sendNoteOff(33, 127, midiChannel);
 }
  if (button10.risingEdge()); {
   usbMIDI.sendNoteOff(34, 127, midiChannel);
 }
  if (button11.risingEdge()); {
   usbMIDI.sendNoteOff(35, 127, midiChannel);
 }
  if (button12.risingEdge()); {
   usbMIDI.sendNoteOff(36, 127, midiChannel);
 }
  if (button13.risingEdge()); {
   usbMIDI.sendNoteOff(37, 127, midiChannel);
 }
  if (button14.risingEdge()); {
   usbMIDI.sendNoteOff(38, 127, midiChannel);
 }
  if (button15.risingEdge()); {
   usbMIDI.sendNoteOff(39, 127, midiChannel);
 }
  while (usbMIDI.read()); {
  }
}

It seems to me that you need to confirm that the 8 things connected to the 8 analog pins are being read correctly. Serial.print() the pin number and the value read from the pin. Are they reasonable values, as you make changes to whatever is connected?

Are the iAlag values appropriate?

PaulS: It seems to me that you need to confirm that the 8 things connected to the 8 analog pins are being read correctly. Serial.print() the pin number and the value read from the pin. Are they reasonable values, as you make changes to whatever is connected?

Are the iAlag values appropriate?

well i just spent like 4-5 hours watching some noob tutorials but most of them DID in fact have a lot of use in my midi controller application, during the tutorials (so far) there as been a segment about pringing the signal from a pot to serial.. (as you suggested PaulS) and with the 250K pots i got from the local audio shop (that were wayyyyyyyyyyy over priced at $7 a pop..) the output is smoother than with a random 10k test pot i salvaged.. though neither will 0 out...

Here is a screenshot of the serial output while i was out having a smoke (the pot sitting at what should have been ZERO with nothing touching it while I was out), it seems the pots are picking up interference regardless of the resistance.

EDIT img tag didnt work so posted as link http://imgur.com/CY7ctzw

And here is the code used for the serial output EDIT this was the only program running on the teensy

int potPin = A0;
void setup ()
{
  pinMode(potPin, INPUT);
  
  Serial.begin(9600);
}

void loop()
{
  Serial.println(analogRead(potPin));
  delay(1000);
}
  pinMode(potPin, INPUT);

Analog pins are INPUT only. Diddling with the digital pin that shares the same space as the analog pin is pointless.

If you are not getting consistent readings from the pots, writing more code is rather pointless.

PaulS:   pinMode(potPin, INPUT);

Analog pins are INPUT only. Diddling with the digital pin that shares the same space as the analog pin is pointless If you are not getting consistent readings from the pots, writing more code is rather pointless.

ok i fugured it out.. it is the code, and its not the code at the same time.. its having the inputs active while only having a couple of components hooked up, then it just sends constant "on" signal instead of a constant off signal.

its having the inputs active while only having a couple of components hooked up

Of course. It makes no sense to read a pin with nothing connected to it, and expect to get 0 from the pin.

PaulS:
Of course. It makes no sense to read a pin with nothing connected to it, and expect to get 0 from the pin.

well for future expansion with out having to add more code it would… thats why i was doing it, though i guess i could just note the code until such a time comes when i want to add more buttons, or pots. (the controller is being built in a broken rack mount network switch so there is lots of extra room for future expansion.

testing each Analog pin in serial monitor WITH the following code

// define how many pots are active up to number of available analog inputs
#define analogInputs 1
// make arrays for input values and lagged input values
int inputAnalog[analogInputs];
int iAlag[analogInputs];
// make array of cc values
int ccValue[analogInputs];
// index variable for loop
int i;
//Changing LED pin
int ledPin = 6;
//Initiates Analog pins for knobs and faders.
int potPin = A2;
void setup() {
  digitalWrite(ledPin, HIGH);
 pinMode(6, OUTPUT);  //led
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
   // loop trough active inputs for knobs
  for (i=0;i<analogInputs;i++){
    // read current value at i-th input
    inputAnalog[i] = analogRead(i);
    // if magnitude of difference is 8 or more...
    if (abs(inputAnalog[i] - iAlag[i]) > 0){
      // calc the CC value based on the raw value
      ccValue[i] = inputAnalog[i]/1;
      // send the MIDI
      usbMIDI.sendControlChange(i, ccValue[i], 3);
      // set raw reading to lagged array for next comparison
      iAlag[i] = inputAnalog[i];
    }
  delay(5); // limits MIDI messages to reasonable number
  }
      Serial.println(analogRead (A1));
  delay(1000);

}

would appear whats causing this jumping value problem…

as running JUST a serial output code…

int ledPin = 6;
void setup ()
{
  pinMode(6, OUTPUT);
  digitalWrite(ledPin, HIGH);
  Serial.begin(9600);
}

void loop()
{
  Serial.println(analogRead (A2));
  delay(1000);
}

… the pins/pots (regardless of the resistance) react normally on every pin. from 0 - 1023 like one would expect…

well for future expansion with out having to add more code it would.

No. That is still wishful thinking. When there is nothing connected to the pin you are trying to read, any expectation that the value will be 0 is just wishful thinking.

You can connect a resistor to the pin and ground, to be assured that the reading will be 0.

PaulS: No. That is still wishful thinking. When there is nothing connected to the pin you are trying to read, any expectation that the value will be 0 is just wishful thinking.

You can connect a resistor to the pin and ground, to be assured that the reading will be 0.

I see that now :P and yea i think thats what i will do even just to be safe and save future headache. going to try writing my own code for the knobs as well to see if its just the chunk of code i borrowed from DJTT's tutorial.