Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- rkuo2000
- Date:
- 2016-10-20
- Revision:
- 0:5ea758382ca4
- Child:
- 1:3f1ad029882f
File content as of revision 0:5ea758382ca4:
// using NuMaker-PFM-NUC472 GPIO pins connected to Buttons, LEDs, Buzzer #include "mbed.h" DigitalOut rgbled_B(PD_8); // low-active DigitalOut rgbled_R(PD_9); // low-active DigitalOut rgbled_G(PA_4); // low-active DigitalOut greenled(PG_0); // low-active DigitalOut buzzer(PD_11); // low-active DigitalIn button_SW1(PC_12); // press button =0 DigitalIn button_SW2(PC_13); // press button =0 // main() runs in its own thread in the OS // (note the calls to Thread::wait below for delays) int main() { rgbled_B=1; rgbled_R=1; rgbled_G=1; greenled=1; buzzer=1; while (true) { // press SW1 will turn on greeled and RGBLED=blue if (button_SW1==0) { greenled=0; rgbled_B=0; } else { greenled=1; rgbled_B=1; } // press SW2 will turn on buzzer if (button_SW2==0) buzzer=0; else buzzer=1; } }