test

main.cpp

Committer:
David Yu
Date:
2017-10-06
Revision:
1:94986ca0db0a
Parent:
0:5ec2204f1886

File content as of revision 1:94986ca0db0a:

// For NuMaker-PFM-NUC472 GPIO pins connected to rgbled, green led, buzzer
#include "mbed.h"

Serial device(PD_5, PD_4); // tx, rx
DigitalOut    rgbled_B(PD_8); // low-active
DigitalOut    rgbled_R(PD_9); // low-active
DigitalOut    rgbled_G(PA_4); // low-active

// main() runs in its own thread in the OS
// (note the calls to Thread::wait below for d elays)
int main() {
    rgbled_R=1;rgbled_G=1;rgbled_B=1;
    device.baud(115200);
    while (true) {
                              rgbled_R=0;
                              rgbled_G=1;
                              rgbled_B=1;
                              wait(1);
                              rgbled_R=1;
                              rgbled_G=0;
                              rgbled_B=1;
                              wait(1);                              
                              rgbled_R=1;
                              rgbled_G=1;
                              rgbled_B=0;
                              wait(1);                  
                              device.printf("Hello World!\n");
    }
}