I was trying to run the sample code for the simpleBLE library, but I had the error code:
Error: No matching member function for call to ‘attach’ in “source/main.cpp”, Line: 18, Col: 7
The sample code:
#include "mbed.h"
#include "SimpleBLE.h"
AnalogIn light(A0);
SimpleBLE ble("MY_LIGHT_SENSOR"); // declare SimpleBLE
// create a new characteristic under service 0x8000, char 0x8001
SimpleChar<uint16_t> lightValue = ble.readOnly_u16(0x8000, 0x8001);
// now treat lightValue like any other variable
void read() {
lightValue = light.read_u16();
}
int main(int, char**) {
Ticker t;
t.attach(&read, 1.0f); // read new value every second
ble.start();
while (1) { ble.waitForEvent(); }
}