Issue connecting Portenta H7 to IoT cloud

I’m working on a project where I’m trying to connect my Arduino Portenta H7 to a Nicla Sense ME via the ESLOV connector. The goal is to read temperature data from the Nicla Sense ME and send it to the Arduino Cloud.

I’ve written the following code, including the thingProperties.h and the main .ino file. When I upload the code and open the Serial Monitor, it displays that it’s connected to Wi-Fi and “Initialize the Nicla as an ESLOV connected device”, but then I get **“An error occurred during after the Initialization in the serial output, and I don’t receive any sensor data.

main.ino

#include "thingProperties.h"
#include "Arduino_BHY2Host.h"

Sensor tempSensor(SENSOR_ID_TEMP);  // Temperature sensor ID

void setup() {
  Serial.begin(9600);
  delay(1500);

  Serial.print("Configuring the Arduino Cloud");
  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);

  Serial.println("Connecting to the Arduino Cloud");
  while (ArduinoCloud.connected() != 1) {
    ArduinoCloud.update();
    delay(500);
  }

  delay(1500);

  Serial.println("Initialize the Nicla as a ESLOV connected device");
  BHY2Host.begin(false, NICLA_VIA_ESLOV);  // use NICLA_VIA_BLE if a wireless connection is desired

  tempSensor.configure(1,0);
  temperature = tempSensor.value();   // take a first sample
}

void loop() {

  BHY2Host.update();

  temperature = tempSensor.value();

  ArduinoCloud.update();

  Serial.print("Temperature: ");
  Serial.println(temperature);

  delay(2000);

}

thingoproperties.h

// Code generated by Arduino IoT Cloud, DO NOT EDIT.

#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>

const char SSID[]     = SECRET_SSID;    // Network SSID (name)
const char PASS[]     = SECRET_OPTIONAL_PASS;    // Network password (use for WPA, or use as key for WEP)

void onTemperatureChange();

float temperature;

void initProperties(){

  ArduinoCloud.addProperty(temperature, READWRITE, 1 * SECONDS, NULL);

}

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

Additional Information:

• I’m using the latest version of the Arduino IDE and have all the necessary libraries installed.

• The Nicla Sense ME is connected to the Portenta H7 via the ESLOV connector.

• The Wi-Fi connection seems to be working fine.

• I’ve double-checked the physical connections, and everything seems secure.

Problem:

• The initialization of the Nicla Sense ME resulting in the error message in the serial

• Because of this, I’m not able to read any sensor data from the Nicla Sense ME.

ciao @zaeron
it seems you're missing a piece of code that runs on the Nicla.

Check this tutorial that does exactly what are you looking for :slight_smile:
https://docs.arduino.cc/tutorials/nicla-sense-me/connecting-to-iot-cloud/