Last active
January 21, 2018 22:38
-
-
Save Youz13/cb7f580a99e35fc44588d41a0f6b2574 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
lastButtonState = buttonState; | |
delay(10); | |
cyclecompt++; | |
} | |
if (buttonCounter == 0) { | |
md2 = initTime; | |
} | |
else { | |
md2 = initTime + ( buttonCounter * 2 ); // Add 2 minutes per push of the mode button | |
} | |
intervaL = 21.0 / ( (float)md2 * 6.0 ); //21 is the interval between brightness change from starting 11 breath per minute (20 ms) to ending 6 breath per minute (41 ms) | |
start = 0; | |
if ( md2 != initTime ) { // blink the number of time mode button is pushed | |
cyclecompt = 1; | |
while (cyclecompt < buttonCounter + 1) { | |
analogWrite(10, 50); delay(200); analogWrite(10, 0); delay(300); | |
cyclecompt++; | |
} | |
delay(800); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment