Created
July 7, 2014 12:01
-
-
Save maxp/d693d133a280e72ef0e8 to your computer and use it in GitHub Desktop.
arduino pro micro - 5 min power off
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
// | |
// arduino pro micro | |
// | |
#define POWER_GREEN 240 | |
#define POWER_YELLOW 40 | |
#define POWER_BLINK 20 | |
#define POWER_OFF 3 | |
#define POWER_PIN 5 | |
void setup() | |
{ | |
Serial.begin(9600); | |
pinMode(POWER_PIN, OUTPUT); | |
} | |
void loop() | |
{ | |
int seconds = POWER_GREEN + POWER_YELLOW + POWER_BLINK; | |
digitalWrite(POWER_PIN, HIGH); | |
Serial.println("on"); | |
TXLED0; RXLED1; for(int i=0; i < POWER_GREEN; i++) { delay(1000); } | |
TXLED1; RXLED0; for(int i=0; i < POWER_YELLOW; i++) { delay(1000); } | |
for(int i=0; i < POWER_BLINK; i++) { | |
for(int j=0; j < 4; j++) { TXLED0; RXLED0; delay(125); TXLED1; RXLED1; delay(125); } | |
} | |
digitalWrite(POWER_PIN, LOW); | |
Serial.println("off"); | |
delay(POWER_OFF*1000); | |
} | |
//. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment