Introduction: Crash Sensor Car

1. Connect cable of analog A0 with photosensor and resistency in one row.

2. Connect cable of v5 to the other leg of photosensor.

3. Connect the other leg of resistency to GND next to V5

4. Connect LED to 13 digital and other to GND

Step 1: Connections

Step 2: Arduino Code

//PHOTORESISTOR ARDUINO

//ANALOG PIN int _analogPin = 0; //LED PIN int _pinLED = 13; void setup() { //SERIAL PORT FOR DEBUGING Serial.begin(9600); //CONFIGURING OUTPUT OF PIN LED pinMode(_pinLED, OUTPUT); } void loop() { //READING ANALOG VALUE OF PIN int value = analogRead(_analogPin); //TURN OFF LED PING digitalWrite(_pinLED, LOW); //DEBUGING VALUE IN ARDUINO MONITOR SERIAL Serial.println(value); if(value <= 720) { digitalWrite(_pinLED,HIGH); delay(1000); } //TURNING ON if(value < 780 && value > 720) { digitalWrite(_pinLED,HIGH); delay(100); digitalWrite(_pinLED,LOW); delay(100); } //WAITING 10 MILISECONDS delay(10); }

Step 3: Video