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.
Dependencies: BLE_API mbed nRF51822
Fork of EddystoneBeaconSwitchLed by
main.cpp
00001 #include "mbed.h" 00002 #include "BLEDevice.h" 00003 #include "DeviceInformationService.h" 00004 00005 int ledOn = 0; 00006 int ledOff = 1; 00007 00008 InterruptIn button1(P0_17); 00009 InterruptIn mysw1(P0_18); 00010 DigitalOut myled1(P0_21); 00011 DigitalOut myled2(P0_22); 00012 DigitalOut myled3(P0_23); 00013 // Serial pc(USBTX,USBRX); 00014 int flag = false; 00015 00016 void handle_button1() { 00017 flag = !flag; 00018 } 00019 00020 00021 void ledflasher() { 00022 myled1 = ledOn; 00023 wait(0.3); 00024 myled1 = ledOff; 00025 myled2 = ledOn; 00026 wait(0.3); 00027 myled2 = ledOff; 00028 myled3 = ledOn; 00029 wait(0.4); 00030 myled3 = ledOff; 00031 } 00032 00033 int main() { 00034 // Initialize button1 and pull up 00035 // set interrupt callback for button1 00036 button1.fall(&handle_button1); 00037 button1.mode(PullUp); 00038 myled1 = ledOff; 00039 myled2 = ledOff; 00040 myled3 = ledOff; 00041 00042 while(1) { 00043 if (flag) { 00044 ledflasher(); 00045 } 00046 wait(0.2); 00047 } 00048 00049 00050 00051 }
Generated on Thu Jul 14 2022 05:18:00 by
1.7.2
