HELLO EVERYONE ,
I have this code and would like to add a button that I can interrupt the ignition of a LED before the set time,
the function of the code is to use a potentiometer, which activates a led me at (threshold = 400) by turning the potentiometer reaches the value and the
led me on, until you press the button the LED should enceder to arrive at the value, now if I press the button before time 15sec the LED is not activated, important is to be executed once mientra the arduino is energized.
unsigned long start = 0;
const int threshold = 400;
const int analogPin = A0;
int led = 6;
void setup() {
start = millis();
pinMode (led, OUTPUT);
Serial.begin(9600);
}
void loop() {
while (millis() - start <= 15000) {
int analogValue = analogRead(analogPin);
if (analogValue > threshold)
digitalWrite(led, HIGH);
else
digitalWrite(led, LOW);
// print the analog value:
Serial.println(analogValue);
} // fin del while
}