Hi Russell,
there are two issues,
-
Nano R4 can not be detected as comport, only show as DFU after double click on reset button. 2 out of 2 failed.
-
UNO Q, detect comport successfully, but qwiic connect port does not trigger by code which is example code tmp102 basic, even change to wire1.begin()
sorry after I give up trying on UNO Q I delete the code, I have try Seeed XIAO board, easily get it work with same sample code. connection as picture
************************************************************
#include <Arduino.h>
#include <U8x8lib.h>
#include <Wire.h> // Used to establied serial communication on the I2C bus
#include <SparkFunTMP102.h> // Used to send and recieve specific information from our sensor
#include <PCF8563.h>
PCF8563 pcf;
union FloatBytes {
float f;
uint32_t as_int; // A 32-bit unsigned integer to match the float size
byte b[4]; // An array of 4 bytes (char or byte works)
};
TMP102 sensor0;
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
void setup(void) {
Serial.begin(115200);
Serial1.begin(115200);
Wire.begin(); //Join I2C Bus
u8x8.begin();
u8x8.setFlipMode(1);
pcf.init();//initialize the clock
pcf.stopClock();//stop the clock
pcf.setYear(26);//set year
pcf.setMonth(1);//set month
pcf.setDay(20);//set dat
pcf.setHour(15);//set hour
pcf.setMinut(48);//set minut
pcf.setSecond(0);//set second
pcf.startClock();//start the clock
if(!sensor0.begin(0x48,Wire))
{
Serial.println(“Cannot connect to TMP102.”);
Serial.println(“Is the board connected? Is the device ID correct?”);
while(1);
}
Serial.println(“Connected to TMP102!”);
delay(100);
}
void loop(void)
{
FloatBytes data;
float temperature;
Time nowTime = pcf.getTime();//get current time
// Turn sensor on to start temperature measurement.
// Current consumtion typically ~10uA.
sensor0.wakeup();
// read temperature data
temperature = sensor0.readTempF();
//temperature = sensor0.readTempC();
// Place sensor in sleep mode to save power.
// Current consumtion typically <0.5uA.
sensor0.sleep();
Serial1.print(nowTime.day);
Serial1.print(“/”);
Serial1.print(nowTime.month);
Serial1.print(“/”);
Serial1.print(“20”);
Serial1.print(nowTime.year);
Serial1.print(nowTime.hour);
Serial1.print(“:”);
Serial1.print(nowTime.minute);
Serial1.print(“:”);
Serial1.println(nowTime.second);
Serial.print(temperature);
Serial.println(“F”);
data.f=temperature;
// Serial.println(data.f, 4);
Serial.println(data.as_int, HEX);
u8x8.setFont( u8x8_font_courR18_2x3_r );
u8x8.setCursor(0,8);
u8x8.print(temperature);
Serial1.print(temperature);
Serial1.println(“F”);
u8x8.setFont(u8x8_font_courR18_2x3_r );
u8x8.setCursor(12, 8);
u8x8.print(“F”);
u8x8.setFont(u8x8_font_courR18_2x3_r );
u8x8.setCursor(0, 12);
u8x8.print(data.as_int,HEX);
Serial1.println(data.as_int,HEX);
delay(60000); // Wait 1000ms