175 Serial.begin(115200);
181 Serial.println(
"Initializing Sensors...");
184 bhy.setFirmware(bosch_firmware_image, bosch_firmware_size);
195#ifdef USE_I2C_INTERFACE
200 Serial.print(
"Failed to initialize sensor - error code:");
201 Serial.println(
bhy.getError());
208#ifdef USE_SPI_INTERFACE
211 Serial.print(
"Failed to initialize sensor - error code:");
212 Serial.println(
bhy.getError());
219 Serial.println(
"Initializing the sensor successfully!");
222 BoschSensorInfo info =
bhy.getSensorInfo();
225 ArduinoStreamPrinter printer(Serial);
226 info.printInfo(printer);
228 info.printInfo([](
const char *format, ...) ->
int {
230 va_start(args, format);
231 int result = vprintf(format, args);
242 float sample_rate = 2.0;
243 uint32_t report_latency_ms = 0;
250#ifdef USING_DATA_HELPER
253 pressure.enable(sample_rate, report_latency_ms);
256 rslt =
bhy.configure(BoschSensorID::TEMPERATURE, sample_rate, report_latency_ms);
257 printResult(BoschSensorID::TEMPERATURE, sample_rate, rslt);
258 rslt =
bhy.configure(BoschSensorID::BAROMETER, sample_rate, report_latency_ms);
259 printResult(BoschSensorID::BAROMETER, sample_rate, rslt);
260 rslt =
bhy.configure(BoschSensorID::HUMIDITY, sample_rate, report_latency_ms);
261 printResult(BoschSensorID::HUMIDITY, sample_rate, rslt);
263 Serial.println(
"Register sensor result callback function");
269#ifdef USING_SENSOR_IRQ_METHOD