-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example sketches for Lightblue Bean? #6
Comments
Hello @TechFactory, Thanks for posting the question and using the plugin. The problem here is that most of the examples provide sketches only for Arduino 101, which is a different board than you have. Some examples like the Unfortunately, the sketches are generally not compatible between different boards and require changes. That's why you see the puzzling error messages about missing Your Bean has a different set of functions that talk to the BLE subsystem. The best way to get started is these examples. Try to create a scratch characteristic, that turns on a LED, when you write Sometimes it's a struggle, but when it's finally working HomeKit is a lot of fun and it's certainly worth it. I'll be happy to add support for more boards and merge a pull request with your new Bean example if you want to do it. |
Hi @vojtamolda, Thanks for the help. I've made this so far. It's shows up in the home app on the iPhone but the temperature says 0 no matter what I do. Any idea? #include <SPI.h>
#include <BLEPeripheral.h>
BLEPeripheral ble;
BLEService informationService("180A");
BLECharacteristic modelCharacteristic("2A24", BLERead, "101");
BLECharacteristic manufacturerCharacteristic("2A29", BLERead, "Arduino");
BLECharacteristic serialNumberCharacteristic("2A25", BLERead, "2.71828");
BLEService thermometerService("1D8A68E0-E68E-4FED-943E-369099F5B499");
BLEFloatCharacteristic temperatureCharacteristic("1D8A68E1-E68E-4FED-943E-369099F5B499", BLERead | BLENotify);
void setup() {
Serial.begin(115200);
ble.setLocalName("Thermo");
ble.setAdvertisedServiceUuid(thermometerService.uuid());
ble.addAttribute(informationService);
ble.addAttribute(modelCharacteristic);
ble.addAttribute(manufacturerCharacteristic);
ble.addAttribute(serialNumberCharacteristic);
ble.addAttribute(thermometerService);
ble.addAttribute(temperatureCharacteristic);
temperatureCharacteristic.setValue(0);
ble.begin();
Serial.println("Bluetooth on");
}
void loop() {
ble.poll();
int tempRead = Bean.getTemperature();
temperatureCharacteristic.setValue(tempRead);
Serial.print(tempRead);
delay(3000);
} Thanks again. |
I don't have a Bean to test, but I think you're puting an float tempRead = (float) Bean.getTemperature();
temperatureCharacteristic.setValue(tempRead); The conversion is probably happening implicitly anyway, but getting the values to match is what matters here. You're seeing 0, because it's the default used by Homebridge when nothing is received. Another way to check where is the problem is to use the LightBlue iOS app. When you change the type of the characteristic to |
One more thing - Maybe I'm wrong, since I'm not very familiar with Bean's hardware, but I don't think it is currently supported by the Bean is in fact an ATmega328p processor and the LBM313 module with battery. The module contains the CC2240 BLE SoC chip by Texas Instruments and an antenna in a nice FCC certified package. Unfortunately the CC2240 isn't supported by the |
Hi There,
I am trying to run it on Lightblue Bean but I get the error ble_protocol.h: No such file or directory after I have imported the CurieBLE and CurieIMU libraries.
You have any idea what could be wrong?
Thanks in advance.
The text was updated successfully, but these errors were encountered: