Skip to content

Instantly share code, notes, and snippets.

@vvps
Created April 20, 2015 16:48
Show Gist options
  • Save vvps/218893450f8300b66de1 to your computer and use it in GitHub Desktop.
Save vvps/218893450f8300b66de1 to your computer and use it in GitHub Desktop.
Arduino LED Blink in Loop
#include <Metro.h>
#define rLED 10
#define gLED 9
#define LED 13
Metro pauseTimer = Metro(1200000);
void setup()
{
pinMode(rLED,OUTPUT);
pinMode(gLED, OUTPUT);
pinMode(LED, OUTPUT);
digitalWrite(rLED,LOW);
analogWrite(gLED,0);
digitalWrite(LED,LOW);
}
void takeRest()
{
digitalWrite(rLED,HIGH);
delay(2000);
digitalWrite(rLED,LOW);
analogWrite(gLED,255);
delay(3000);
analogWrite(gLED,0);
}
void loop()
{
if (pauseTimer.check() == 1) {
takeRest();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment