test

Committer:
davyu
Date:
Thu Oct 05 17:55:42 2017 +0000
Revision:
0:5ec2204f1886
Child:
1:94986ca0db0a
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
davyu 0:5ec2204f1886 1 // For NuMaker-PFM-NUC472 GPIO pins connected to rgbled, green led, buzzer
davyu 0:5ec2204f1886 2 #include "mbed.h"
davyu 0:5ec2204f1886 3
davyu 0:5ec2204f1886 4 Serial pc(USBTX, USBRX); // tx, rx
davyu 0:5ec2204f1886 5 DigitalOut rgbled_B(PD_8); // low-active
davyu 0:5ec2204f1886 6 DigitalOut rgbled_R(PD_9); // low-active
davyu 0:5ec2204f1886 7 DigitalOut rgbled_G(PA_4); // low-active
davyu 0:5ec2204f1886 8
davyu 0:5ec2204f1886 9 // main() runs in its own thread in the OS
davyu 0:5ec2204f1886 10 // (note the calls to Thread::wait below for d elays)
davyu 0:5ec2204f1886 11 int main() {
davyu 0:5ec2204f1886 12 rgbled_R=1;rgbled_G=1;rgbled_B=1;
davyu 0:5ec2204f1886 13 while (true) {
davyu 0:5ec2204f1886 14 rgbled_R=0;
davyu 0:5ec2204f1886 15 rgbled_G=1;
davyu 0:5ec2204f1886 16 rgbled_B=1;
davyu 0:5ec2204f1886 17 wait(1);
davyu 0:5ec2204f1886 18 rgbled_R=1;
davyu 0:5ec2204f1886 19 rgbled_G=0;
davyu 0:5ec2204f1886 20 rgbled_B=1;
davyu 0:5ec2204f1886 21 wait(1);
davyu 0:5ec2204f1886 22 rgbled_R=1;
davyu 0:5ec2204f1886 23 rgbled_G=1;
davyu 0:5ec2204f1886 24 rgbled_B=0;
davyu 0:5ec2204f1886 25 wait(1);
davyu 0:5ec2204f1886 26 pc.printf("Hello World!\n");
davyu 0:5ec2204f1886 27 }
davyu 0:5ec2204f1886 28 }