Skip to content

Instantly share code, notes, and snippets.

@maxp
Created July 7, 2014 12:01
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 maxp/d693d133a280e72ef0e8 to your computer and use it in GitHub Desktop.
Save maxp/d693d133a280e72ef0e8 to your computer and use it in GitHub Desktop.
arduino pro micro - 5 min power off
//
// 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