Created
April 20, 2015 16:48
-
-
Save vvps/218893450f8300b66de1 to your computer and use it in GitHub Desktop.
Arduino LED Blink in Loop
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
#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