am i on the right line?
i did noticed the LED starts LOW not HIGH?
const int ledPin = 13; // the number of the LED pin
long sensorPin = A0; // select the input pin for the potentiometer
long sensorValue = 0; // variable to store the value coming from the sensor
// Variables will change:
int ledState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated
void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
}
void loop()
{
long sensorValue = analogRead(sensorPin);
long sensor = map(sensorValue, 0, 1023, 30000UL, 1500000UL);
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > sensor) {
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
}
}