Last active
April 27, 2021 15:32
-
-
Save takataka5614/d0ee18984dc58460b1ed3cd4aca61db0 to your computer and use it in GitHub Desktop.
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
#define OnB_LED 2 | |
int LedState = 0; | |
unsigned long previousMillis = 0; | |
void setup() { | |
pinMode(OnB_LED, OUTPUT); | |
} | |
void loop() | |
{ | |
unsigned long currentMillis = millis(); | |
if(currentMillis - previousMillis >= 1000) { | |
if (LedState == 0) { | |
digitalWrite(OnB_LED, HIGH); | |
LedState = 1; | |
} | |
else { | |
digitalWrite(OnB_LED, LOW); | |
LedState = 0; | |
} | |
previousMillis = currentMillis; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment