Nuvoton
/
NuMaker-mbed-GPIO-button-buzzer-rgbled
NuMaker GPIO button with LED and buzzer
Diff: main.cpp
- Revision:
- 5:4a573124ab4a
- Parent:
- 1:7a0a00da91c7
- Child:
- 8:876e8a140f39
--- a/main.cpp Thu Dec 15 10:59:54 2016 +0800 +++ b/main.cpp Thu Dec 22 15:08:55 2016 +0800 @@ -1,6 +1,6 @@ // For NuMaker-PFM-NUC472 GPIO pins connected to rgbled, green led, buzzer #include "mbed.h" - +#if defined(TARGET_NUMAKER_PFM_NUC472) DigitalOut rgbled_B(PD_8); // low-active DigitalOut rgbled_R(PD_9); // low-active DigitalOut rgbled_G(PA_4); // low-active @@ -8,9 +8,18 @@ DigitalOut buzzer(PD_11); // low-active DigitalIn button_SW1(PC_12); // press button =0 DigitalIn button_SW2(PC_13); // press button =0 +#elif defined(TARGET_NUMAKER_PFM_M453) +DigitalOut rgbled_B(PD_7); // low-active +DigitalOut rgbled_R(PD_2); // low-active +DigitalOut rgbled_G(PD_3); // low-active +DigitalOut greenled(PB_12); // low-active +DigitalOut buzzer(PE_2); // low-active +DigitalIn button_SW1(PA_15); // press button =0 +DigitalIn button_SW2(PA_14); // press button =0 +#endif // main() runs in its own thread in the OS -// (note the calls to Thread::wait below for delays) +// (note the calls to Thread::wait below for d elays) int main() { rgbled_B=1; rgbled_R=1; rgbled_G=1;