Keith Mitchell / Mbed OS Hexidraw_Demo

Dependencies:   Hexidraw

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "hexidraw.h"
00003 
00004 #include "images.h"
00005 
00006 DigitalOut led_blue(PTC9);
00007 
00008 OLED oled;
00009 
00010 int main() {
00011     oled.begin();
00012     oled.wake();
00013     oled.clear(BLACK);
00014     
00015     //Draw a background image
00016     oled.image(0,0,hexi_gradiant_bmp_bmp);
00017     
00018     //Draw the olympic rings
00019     uint16_t rad = 10;
00020     uint8_t pad = 2;
00021     uint8_t width = 3;
00022     oled.circle(OLED_WIDTH/2, OLED_HEIGHT/2, rad, Color565(0,0,0), width);
00023     
00024     oled.circle((OLED_WIDTH/2)-((rad*2)+pad), OLED_HEIGHT/2, rad, Color565(0,0,255), width);
00025     oled.circle((OLED_WIDTH/2)+((rad*2)+pad), OLED_HEIGHT/2, rad, Color565(255,0,0), width);
00026 
00027     oled.circle((OLED_WIDTH/2)-((rad*2)/2), OLED_HEIGHT/2+(rad+pad), rad, Color565(255,255,0), width);
00028     oled.circle((OLED_WIDTH/2)+((rad*2)/2), OLED_HEIGHT/2+(rad+pad), rad, Color565(0,255,0), width);
00029 
00030 
00031     while (true) {
00032         led_blue = !led_blue;
00033         Thread::wait(500);
00034     }
00035 }
00036