// these constants won't change:
const int ignitionLed = 13;
const int analogPin = A0;
const int threshold = 500;
void setup() {
//initialise the led as a output:
pinMode(ignitionLed, OUTPUT);
// initialise serial communication:
Serial.begin(9600);
}
void loop() {
// read value of potentiometer:
int analogValue = analogRead(analogPin);
// if value is high enough turn led off
if (analogValue > threshold) {
digitalWrite(ignitionLed, LOW);
delay(75);
} else {
digitalWrite(ignitionLed, HIGH);
}
// print the serial comms:
Serial.println(analogValue);
delay(1);
}