Created
August 31, 2017 15:08
-
-
Save deejaygraham/76e2bf80980db73e3396ab233d360e60 to your computer and use it in GitHub Desktop.
blinking light example in c++
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 "MicroBit.h" | |
MicroBit micro_bit; | |
int main() | |
{ | |
micro_bit.init(); | |
const int delay_in_milliseconds = 1000; | |
const int full_brightness = 255; | |
const int zero_brightness = 0; | |
while(1) | |
{ | |
micro_bit.display.image.setPixelValue(2, 2, full_brightness); | |
micro_bit.sleep(delay_in_milliseconds); | |
micro_bit.display.image.setPixelValue(2, 2, zero_brightness); | |
micro_bit.sleep(delay_in_milliseconds); | |
} | |
// low power sleep mode. | |
release_fiber(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment