Alright, the whole idea is like this:
A sheet of LEDs surrounding the car that lights up whenever there’s something close to the car by a lane.
So, initial thoughts, try with a single LED and an IR sensor. Something like this:
I stuck the IR sensor to my car door like this:
Here’s the code for the Arduino:
int led1 = 13;
int sensor = A0;
void setup() {
Serial.begin(9600);
pinMode(led1, OUTPUT);
}
void loop() {
int Value = analogRead(A0);
if ( Value > 100){
digitalWrite(13, HIGH);
}
else {
digitalWrite(13, LOW);
}
Serial.println(Value);
}
Well, my first test have failed because, apparently the IR sensor is weak against speed and black or reflective surfaces.
Here’s a 3 minutes video that shows my trip:
Next time, I’ll try replacing the IR sensor with ultrasound… Yes, apparently I’m gonna sonar some babies -_-;