/*Sensor Reading*/ int analogSensor = 0; int sensorValue = 0; int ledPin = 13; // select the pin for the LED int val = 0; // variable to store the value coming from the sensor int DEBUG = 1; void setup() { pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT if (DEBUG) { Serial.begin(9600); // configure serial connection } } void loop() { sensorValue = analogRead(analogSensor); //read the analog sensor digitalWrite(ledPin, HIGH); // turn the ledPin on delay(sensorValue); // stop the program for some time digitalWrite(ledPin, LOW); // turn the ledPin off delay(sensorValue); // stop the program for some time if (DEBUG) { // If debugging, report loop, tone, beat, and duration Serial.println(sensorValue, DEC); } }