![](/media/cache/profiles/6b871a276e72b1d0583f9d7bdf0d7bfd.jpg.50x50_q85.jpg)
WIP demo program for using my Hexidraw library
Demo app for using my Hexidraw library for drawing on the Hexiwear's OLED
Diff: main.cpp
- Revision:
- 0:3975ec26d269
- Child:
- 1:e5806bc5d2e9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Aug 19 01:18:32 2016 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" + +#include "hexidraw.h" + +//DigitalOut led_red(PTC8); +//DigitalOut led_green(PTD0); +DigitalOut led_blue(PTC9); + +OLED oled; + +// main() runs in its own thread in the OS +// (note the calls to Thread::wait below for delays) +int main() { + oled.begin(); + oled.wake(); + + oled.rect(0, 0, OLED_WIDTH, OLED_HEIGHT, BLACK); + oled.pixel(1, 1, Color565(0, 255, 0)); + uint16_t c1 = Color565(255, 0, 0); + uint16_t c2 = Color565(0, 255, 0); + uint16_t c3 = Color565(0, 0, 255); + uint8_t i = 0; + while (true) { + if(i == 0) + oled.rect(0, 0, OLED_WIDTH, OLED_HEIGHT, c1); + if(i == 1) + oled.rect(0, 0, OLED_WIDTH, OLED_HEIGHT, c2); + if(i == 2) + oled.rect(0, 0, OLED_WIDTH, OLED_HEIGHT, c3); + led_blue = !led_blue; + Thread::wait(500); + ++i; + if(i > 2) + i = 0; + } +} +