Skip to content

Instantly share code, notes, and snippets.

@limtbk
Created December 9, 2015 15:30
Show Gist options
  • Save limtbk/f629ad7b81355f9d80a2 to your computer and use it in GitHub Desktop.
Save limtbk/f629ad7b81355f9d80a2 to your computer and use it in GitHub Desktop.
Test firmware for GoITeens Arduino's
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