text: but don`t get the idea whitch one to use....
  #include <Servo.h>Servo acc;int servoPin = 9;int stalkPin = 0;int potPin = 1;int val; //value from cruise stalkint pos; //value from knob (later - tachometer)void setup(){ acc.attach(servoPin); pinMode(stalkPin, INPUT); pinMode(potPin, INPUT); Serial.begin(9600);}void loop(){ val = analogRead(stalkPin); pos = analogRead(potPin); pos = map(pos, 0, 1023, 0, 179); Serial.println(val); //just to monitor what values are given by cruise stalk delay(10); if (val > 940 && val < 980) //this is SET/COAST mode, this is where I need for servo to hold its position given by knob (later- tach) first to solve SET mode, then coast mode.{ acc.write(pos); //need to set servo to hold its position and follow knob movement.}if (val > 990 && val < 1010) //this is RESUME/ACC function. Resume sounds difficult, so lets start with Accelerate{ acc.write(pos + 10); //servo position +10 values to open throttle a bit to give more juice.}if (val > 850 && val < 900) //this is CANCEL, that can be solved later.{ }if (val > 1018 && val < 1023) //this is ON/OFF switch. I think that should be at the start of the loop, and also, need to remember previous state...{ }}
  pinMode(potPin, INPUT); pos = analogRead(potPin);
  as I said, this is my first code I am writing.
  If we can put aside the dangerous project
  Both - stalk and knob are connected to analog inputs. What difference does it make?
  Whats wrong with setting pinMode?
  the stalk is like momentary switch. after each press it returns to ''0''
  so I need to monitor the previous state? I dont get this part.
  int nonZeroVal = 0;void loop(){ int val = analogRead(stalkPin); if(val > 0) { npnZeroVal = val; } if(nonZeroVal > 940 && nonZeroVal < 980) { // Move the servo } else // Remaining clauses...}
  ''Why do you not print the value from the map function (with some prefix so you know what the value being printed is?''this I dont understand either
  Serial.print("stalk val: ");Serial.println(val);Serial.print("servo pos: ");Serial.println(pos);
  Analog pins are, by definition, output only.
  sp. "input"
  Quoteas I said, this is my first code I am writing.Then I would strongly recommend that you don't do this project. Controlling a car is a very safety critical thing to do. It is not the project you should start with. There are lots of things that can go wrong both with software and hardware. A car is a very hardware hostile environment, things can go wrong even if you know what you are doing.There is a warning on the data sheet of the 328 processor not to use it for life dependent systems or automobile applications.
  I WILL NOT put it it my car untill I am 100% sure it is working right.
  Come on, there are brakes ......