Jan Jongboom / Mbed 2 deprecated HPE_LightSensor

Dependencies:   BLE_API mbed nRF51822

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

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 }