You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The official reference (https://www.arduino.cc/reference/en/libraries/arduino_sciencejournal/) states that this library is compatible with the Arduino Nano 33 IoT - Board. As there is no example code provided, I tried to derivate it from the given firmware for the Arduino Nano 33 BLE Sense and came up with this "minimal" code, which I was able to compile and upload to a Nano IoT.
#include <ArduinoBLE.h>
const int VERSION = 0x00000001;
#define UUID(val) ("cfccb0fd-" val "-4da3-afaf-a4305a6b64b3")
#define DEBUG 1
BLEService service (UUID("0000"));
BLEUnsignedIntCharacteristic versionCharacteristic (UUID("0001"), BLERead);
BLEFloatCharacteristic testCharacteristic (UUID("0002"), BLENotify);
String name;
unsigned long lastNotify = 0;
void printSerialMsg(const char * msg) {
#ifdef DEBUG
if (Serial) {
Serial.println(msg);
}
#endif
}
void updateSubscribedCharacteristics() {
if (testCharacteristic.subscribed()) {
float test = 3.141;
testCharacteristic.writeValue(test);
}
}
void setup() {
#ifdef DEBUG
Serial.begin(9600);
while (!Serial);
Serial.println("Started");
#endif
delay(5000);
if (!BLE.begin()) {
printSerialMsg("Failed to initialized BLE!");
}
String address = BLE.address();
#ifdef DEBUG
if (Serial) {
Serial.print("address = ");
Serial.println(address);
}
#endif
address.toUpperCase();
name = "Nano IoT - ";
name += address[address.length() - 5];
name += address[address.length() - 4];
name += address[address.length() - 2];
name += address[address.length() - 1];
#ifdef DEBUG
if (Serial) {
Serial.print("name = ");
Serial.println(name);
}
#endif
BLE.setLocalName(name.c_str());
BLE.setDeviceName(name.c_str());
BLE.setAdvertisedService(service);
service.addCharacteristic(versionCharacteristic);
service.addCharacteristic(testCharacteristic);
versionCharacteristic.setValue(VERSION);
BLE.addService(service);
BLE.advertise();
digitalWrite(LED_BUILTIN, HIGH);
}
void loop() {
while (BLE.connected()) {
unsigned long now = millis();
if (abs((long) now - (long) lastNotify) >= 100) {
updateSubscribedCharacteristics();
lastNotify = now;
}
}
}
After compiling and uploading this, I was able to see the advertised services in a BLE scanner (used LightBlue) and could see the Nano IoT as a connected device in my settings.
As a consequence, i would have expected the Nano IoT and the testCharacteristic to be listed as sensor in the App, but neither the device nor the characteristic is shown. I have been using the latest version of this library and of the ArduinoBLE library as well. The device used is an iPhone 5s and the latest version of the Arduino Science Journal App is installed.
I was not able to find any documentation on how a service has to be structured such that the App accepts it as a sensor. As you are providing this library for connecting Arduino devices to the App, i´m placing this issue here but if you think it would be more appropiate in the App-repository, feel free to transfer it.
The text was updated successfully, but these errors were encountered:
per1234
changed the title
unable to connect device to Arduino Science Journal App
Unable to connect Nano 33 IoT to Arduino Science Journal App
Mar 2, 2023
The official reference (https://www.arduino.cc/reference/en/libraries/arduino_sciencejournal/) states that this library is compatible with the Arduino Nano 33 IoT - Board. As there is no example code provided, I tried to derivate it from the given firmware for the Arduino Nano 33 BLE Sense and came up with this "minimal" code, which I was able to compile and upload to a Nano IoT.
After compiling and uploading this, I was able to see the advertised services in a BLE scanner (used LightBlue) and could see the Nano IoT as a connected device in my settings.
As a consequence, i would have expected the Nano IoT and the testCharacteristic to be listed as sensor in the App, but neither the device nor the characteristic is shown. I have been using the latest version of this library and of the ArduinoBLE library as well. The device used is an iPhone 5s and the latest version of the Arduino Science Journal App is installed.
I was not able to find any documentation on how a service has to be structured such that the App accepts it as a sensor. As you are providing this library for connecting Arduino devices to the App, i´m placing this issue here but if you think it would be more appropiate in the App-repository, feel free to transfer it.
The text was updated successfully, but these errors were encountered: