Skip to content

Instantly share code, notes, and snippets.

@Youz13
Last active January 21, 2018 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Youz13/cb7f580a99e35fc44588d41a0f6b2574 to your computer and use it in GitHub Desktop.
Save Youz13/cb7f580a99e35fc44588d41a0f6b2574 to your computer and use it in GitHub Desktop.
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