GR-LYCHEEに搭載されている4つのLEDと2つのボタンを制御するサンプルプログラムです。

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut green(LED1);
00004 DigitalOut yellow(LED2);
00005 DigitalOut orange(LED3);
00006 DigitalOut red(LED4);
00007 
00008 DigitalIn UB0(USER_BUTTON0);
00009 DigitalIn UB1(USER_BUTTON1);
00010 
00011 Serial pc(USBTX, USBRX);
00012 
00013 int main() 
00014 {
00015     while(1)
00016     {
00017         pc.printf("test ! \r\n");
00018         
00019         while (UB0 == 0 && UB1 == 0) 
00020         {
00021             green = !green;
00022             wait(0.2);
00023         
00024             yellow = !yellow;
00025             wait(0.2);
00026         
00027             orange = !orange;
00028             wait(0.2);
00029         
00030             red = !red;
00031             wait(0.2);
00032         }
00033     }
00034 }
00035