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
main.cpp
00001 #include "mbed.h" 00002 #include "SimpleBLE.h" 00003 00004 SimpleBLE ble("HPE_LIGHTSENSOR"); 00005 ReadOnlyCharacteristic<uint16_t>* lightChar = ble.createReadOnlyChar<uint16_t>(0x9381, 0x9382, true, 1023); 00006 00007 DigitalOut led(LED1); 00008 AnalogIn light(A0); 00009 00010 void blink() { 00011 led = !led; 00012 00013 lightChar->update(light.read_u16()); 00014 } 00015 00016 int main(int, char**) { 00017 Ticker t; 00018 t.attach(blink, 1.0f); 00019 00020 ble.spin(); 00021 00022 // will never return 00023 }
Generated on Tue Jul 19 2022 04:55:26 by
1.7.2