Newbie working with jumpers. Analog input question

Hi, i have a doubt about analogic inputs.

My project has a X shape jumper like this:


The user has to connect the jumper between O and other number.

I connect 1 to a digital output pin in arduino. For example pin11

Between 1 and 2 is a 1k resistor
The same between 2 and 3, and the same between 3 and 4

I connect 4 to GND pin in arduino.

What I do, at the begining of the sketch (setup) is ti check where is the jumper, where the user has put it.

I put HIGH in pin 11, and read O with muy analog input.

I will read, from 0 to 1023, in my analog pin about 0, 333, 666, 1023 for jumpers 4, 3, 2, 1. After that i put output pin11 to LOW.

My question is: can I connect directly and output pin High to an analog input ? Or do I need a resistor between pin11 and jumper 1 ?

Best regards,

Your question seems terrible confusing to me.

Post a schematic and your code and what exactly you are trying to do.

Thanks for your help.

This is the skectch (not the whole sketch, but enogh):

const byte pinJumperVcc = 8; //Pin 8
const byte pinJumperRead = A0; //Analog 0 

const int   resistanalog[] = {200,500,850}; // (0..1023)
int   resistread;
byte  resistJumper;

void setup()

  pinMode(pinJumperVcc, OUTPUT);
  digitalWrite(pinJumperVcc, HIGH);
  resistread = analogRead(pinJumperRead);
  digitalWrite(pinJumperVcc, LOW);
  if (resistread < resistanalog[0]){
    resistJumper= 0;
  else if (resistread < resistanalog[1]){
    resistJumper= 1;
  else if (resistread < resistanalog[2]){
    resistJumper= 2;
  else {
    resistJumper= 3;

  Serial.print("Resistencia Seleccionada (0..3): ");

And the circuit. (i can't find jumpers in Multisim, but for understanding it I have used a rotatory switch).

May be could you understand it now ??

The jumper is for the user to select and option. I prefer jumpers than buttons or similar. And I don't have any rotatory switch

Thanks a lot.

Much more sense.

Yes, you can directly connect a Digitial high output to an analog input. However, if you want to play it safe, increase all of the resistors in your circuit to 10K and put a 1K resistor in series from the digital output to the beginning of your resistor ladder. This will prevent you from ever reaching 1023, but will prevent a short circuit if something weird were to happen.

Also, I'd consider putting 100nF caps across each resistor as well to reduce noise.


Why caps? Has arduino such noise? Is it not enough the 100 miliseconds delay?