Skip to content

Instantly share code, notes, and snippets.

cyclecompt = 0;
while (cyclecompt < 220) {
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if ( brightness <= 10 ) { // On ending invert fadeAmount for next fade in
fadeAmount = -fadeAmount;
delay(1000);
}
if ( brightness >= 115 ) { // If led is full bright, invert fadeAmount to fade out
fadeAmount = -fadeAmount;
if (start == 1) { // Run startup loop
StarT();
}
if ( millis() >= temps + 10000 ) { // every 10 seconds, fade in/fade out slow down
delayM = delayM + intervaL;
temps = temps + 10000;
}
if ( temps > md2 * 60000 ) { // check if the selected number of minutes is reach
EnD();
}
analogWrite(10, 30); delay(200); analogWrite(10, 0); delay(300); analogWrite(10, 30); delay(200); analogWrite(10, 0); delay(1000); // blink 2 times when arduino boot finish
while (cyclecompt < 500) { // check for 5 seconds the number of time mode button is pushed
buttonState = digitalRead(mode);
if (buttonState != lastButtonState) {
if (buttonState == HIGH) {
buttonCounter++;
delay(200);
}
}
@Youz13
Youz13 / FADing.ino
Last active January 21, 2018 22:39
FADing (Fall Asleep Device)
/*
FADing : version 1.0
Made by : Youz
1- Push ON button to power up until you see 1 flash.
2- To add more minutes to the process, you have 5 seconds to add 2 more minutes for each push on the "mode" button.
3- To switch betwin top light or inside light, quick push the "mode" button.
4- To shutdown, long push the "mode" button.
*/