duemilanove analog multiple inputs


i’m new to arduino, and the only programing i ever did was run diagrams so this is proving interesting, i had read in the mouton of web pages i have read that you can put more than on switch on a analog input, i have a uno and an duemilanove boards, i have the input of my N.O. switches going to analog pin 0 with a 100k resister to gnd. i have 8 switches resistance as follows.

i’m trying to use the duemilanove board for this.

sw1 = 0k
sw2 = 1k 1x1k resistor
sw3 = 15k 1x15k resistor
sw4 = 30k 2x15k resistor
sw5 = 45k 3x15k resistor
sw6 = 60k 4x15k resistor
sw7 = 75k 5x15k resistor
sw8 = 90k 6x15k resistor

i’m also powering the duemilanove board from a computer power supply i found that when i run the program i found on the net it would give me more stable #'s in the serial monitor, the numbers i’m getting are 263 to 268 without any buttions pushed i’m assuming this is the 100k resister between analog pin 0 and gnd. when i push a button either the numbers are scrolling too fast to see a change or my resistance isn’t correct and the duemilanove isn’t seeing the change.

according to the documentation in this .pde the first part should, when a button is pushed give you the value of the button (0-1024) it may be doing it but i can’t catch the change in the scrolling #'s so before i scrap this and start over i thought i would ask and maybe there is something easy i’m missing or maybe my thinking is wrong.

a couple of questions
what is the difference in the uno and the duemilanove ?
how do you tell what version boot loader is on them and if i should up date the bios?

Reading_with_debounce_test.pde (3.64 KB)

i posted the code i'm using as an attachment at the bottom of my first post, realy not sure how to put it into a post with out just copying and pasting it in the body of the post.

  Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
  press), the output pin is toggled from LOW to HIGH or HIGH to LOW.  There's
  a minimum delay between toggles to debounce the circuit (i.e. to ignore
  created 28 October 2009
  by Riaan Cornelius

 // constants won't change. They're used here to 
 // set pin numbers:
 const int buttonPin = 0;     // the number of the pushbutton pin
 const int ledPin =  13;      // the number of the LED pin for testing
 const int BUTTON1 = 1;
 const int BUTTON2 = 2;
 const int BUTTON3 = 3;
 const int BUTTON4 = 4;
 const int BUTTON5 = 5;
 const int BUTTON1LOW = 970;
 const int BUTTON1HIGH = 1024;
 const int BUTTON2LOW = 850;
 const int BUTTON2HIGH = 950;
 const int BUTTON3LOW = 700;
 const int BUTTON3HIGH = 800;
 const int BUTTON4LOW = 400;
 const int BUTTON4HIGH = 650;
 const int BUTTON5LOW = 250;
 const int BUTTON5HIGH = 350;
 // Variables will change:
 int ledState = HIGH;         // the current state of the output pin
 int buttonState;             // the current reading from the input pin
 int lastButtonState = LOW;   // the previous reading from the input pin

 // the following variables are long's because the time, measured in miliseconds,
 // will quickly become a bigger number than can be stored in an int.
 long lastDebounceTime = 0;  // the last time the output pin was toggled
 long debounceDelay = 50;    // the debounce time; increase if the output flickers

 void setup() {
   pinMode(buttonPin, INPUT);
   pinMode(ledPin, OUTPUT);

 void loop() {
   // read the state of the switch into a local variable:
   int reading = analogRead(buttonPin);

maybe that will work smiling learn something new everyday

thank you KE7GKP
that was out standing worked like a charm, i do have one other question i have a pc relay driver board k74v2 do i need any resistors to run this board offen my arduino board it has an optical isolation chip, i have tried it and it works i just don’t wont anything to destroy the arduino board (posted the pdf at the bottom of this post)

k74v2.pdf (126 KB)