WIP demo program for using my Hexidraw library

Dependencies:   Hexidraw

Demo app for using my Hexidraw library for drawing on the Hexiwear's OLED

main.cpp

Committer:
keithm01
Date:
2016-08-19
Revision:
0:3975ec26d269
Child:
1:e5806bc5d2e9

File content as of revision 0:3975ec26d269:

#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;
    }
}