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

main.cpp

Committer:
shundai
Date:
2018-11-18
Revision:
0:2a9cece547f6

File content as of revision 0:2a9cece547f6:

#include "mbed.h"

DigitalOut green(LED1);
DigitalOut yellow(LED2);
DigitalOut orange(LED3);
DigitalOut red(LED4);

DigitalIn UB0(USER_BUTTON0);
DigitalIn UB1(USER_BUTTON1);

Serial pc(USBTX, USBRX);

int main() 
{
    while(1)
    {
        pc.printf("test ! \r\n");
        
        while (UB0 == 0 && UB1 == 0) 
        {
            green = !green;
            wait(0.2);
        
            yellow = !yellow;
            wait(0.2);
        
            orange = !orange;
            wait(0.2);
        
            red = !red;
            wait(0.2);
        }
    }
}