no , i want all in real time , no delay . I want when is active sensor , one led is make a flash , and another led to fade . That's all . The sensor is like a buton , if i push him ( but i not keep him down , just one clik ) one led is make a flash and the other is make fade .
this is what we wrote. The processor will sense a change in the level
if ( analogRead(A0) < 630)
without any delays in the code. We are not using delays here.
Perhaps you can put into this what you mean, even if it is not correct:
void loop()
{
if ( analogRead(A0) < 630)
{
Serial.println("close to sensor");
if (readyToFlash)
{
if (flashing = false) startTime = millis();
Serial.println("FLASH");
flashLedPinOnce();
}
if (fadeOn == true) fadePinNine();
}
else
{
Serial.println("far from sensor");
allPinsOff();
readyToFlash = true;
fadeOn = true;
}
}