I’ve made an indicator which can move when people revolve the knob. And with the movement of the indicator, 2 leds will be turned on. If the indicator moved in 120 degree, the green one will be brighter and brighter, but it will turned off if the indicator moved more than 120 degrees. After the green one turned off, the right one will be on and show the dangerous. I am trying to get some connection between this one with the speed of the car.
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
int led1 = 6;
int led2 = 5;
Servo myservo; // create servo object to control a servo
int sensor = A0;// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
pinMode(led2, OUTPUT); // attaches the servo on pin 9 to the servo object
pos = map (analogRead(sensor),0,1023,0,180);