A I2C sensor MAX30208 is interface with Arduino and it is working as expected. But when the same sensor is interfaced with UNO R4 wifi, the sensor is not getting intialized.
#include <Wire.h>
#include "max30208.h"
#define WIRE Wire //if Quiic connector of R4 is used, use Wire1
MAX30208 max30208;
void setup()
{
Serial.begin(9600);
WIRE.begin();
uint8_t slave_address = max30208.check_max30208_address(WIRE);
if (slave_address == 0)
{
Serial.println("Ooops, MAX30208 not detected ... Check your wiring!");
while (1);
}
max30208.begin(WIRE,slave_address);
Serial.println("MAX30208 initialized");
max30208.enable_temp_rdy_interrupt();
delay(100);
max30208.start_conversion();
delay(100);
}
void loop()
{
uint8_t status = max30208.get_status();
if (status)
{
int sample_count = max30208.get_sample_count();
max30208.convert_raw_data_to_temp(sample_count);
max30208.start_conversion();
}
delay(1000);
}
If the sensor is connected to the SDA and SCL pins via jumper wires, I used Wire. If the sensor is interfaced with the uno R4 via the Quiic connector, used Wire1.
The pins on max30208 and its respective connection:
SDA -> SDA
SCL -> SCL
GND -> GND
Vin -> 3.3V