Created
December 9, 2015 15:30
-
-
Save limtbk/f629ad7b81355f9d80a2 to your computer and use it in GitHub Desktop.
Test firmware for GoITeens Arduino's
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
void setup() { | |
pinMode(13, OUTPUT); | |
} | |
void loop() { | |
static uint16_t t = 0; | |
static uint8_t k = 0; | |
static int8_t i = 1; | |
t++; | |
if ((t & 0xFF) < k) { | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
} else { | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
} | |
if ((t & 0x3FF) == 0) { | |
k+=i; | |
if (k == 0) { | |
i = 1; | |
} | |
if (k == 0xFF) { | |
i = -1; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment