AD-128160-UART制御用のライブラリ http://mbed.org/users/nucho/libraries/AD128160/m24mml を試してみるシンプルなプログラムです。 === image === {{http://farm8.staticflickr.com/7028/6496821539_333a08b551.jpg}} === circuit === {{http://farm8.staticflickr.com/7164/6498120233_a004e4fe29.jpg}}

Dependencies:   mbed AD128160

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "AD128160.h"
00003 
00004 AD128160 lcd(p9,p20);
00005 
00006 int rgb565(int r, int g,int b) {
00007     int rgb;
00008 
00009     rgb = (r & 0xF8) << 8;        /* RRRRR----------- */
00010     rgb |= (g & 0xFC) << 3;       /* -----GGGGGG----- */
00011     rgb |= b >> 3;                /* -----------BBBBB */
00012 
00013     return rgb;
00014 }
00015 
00016 int main() {
00017     lcd.textBackground(1,rgb565(255,0,0));
00018     
00019     lcd.locate(2,lcd.rows()/2);
00020     lcd.printf("Hello World!\n");
00021 
00022     lcd.color(rgb565(0,255,0));
00023     lcd.box(12,76,116,100,0);
00024     lcd.box(8,120,124,146,1);
00025 
00026     lcd.color(rgb565(255,0,0));
00027     lcd.circle(16,40,16,0);
00028     lcd.circle(48,40,16,1);
00029     lcd.circle(80,40,16,1);
00030     lcd.circle(112,40,16,0);
00031 }