Ok,
I copied out the example from the Seeed Studio webpage on freeRTOS and I get this when I run it. Which I am guessing is incorrect.
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x3fcebeb0
A10 : 0x3fcebf44 A11 : 0x00000000 A12 : 0x0000000c A13 : 0x3fcebf50
A14 : 0x0f5c28f6 A15 : 0x00000000 SAR : 0x00000002 EXCCAUSE: 0x0000001c
EXCVADDR: 0xb30baa34 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xffffffff
Backtrace: 0x400556d2:0x3fcebee0 0x420068b2:0x3fcebef0 0x420069b9:0x3fcebf10 0x42002ce7:0x3fcebf30 0x420099cf:0x3fcebf80 0x4038007e:0x3fcebfa0
ELF file SHA256: 19938a1ace65acda
Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x29 (SPI_FAST_FLASH_BOOT)
Saved PC:0x4037ac7a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fd0
entry 0x403c98ac
Connecting to uzr-30344```
type or paste code here
My code is identical; I made a slightly shorter version since I don’t have all the hardware they show to hand.
#include "time.h"
#include <WiFi.h>
#include <PCF8563.h>
#include <Wire.h>
#include "seeed_bme680.h"
const char *ssid = "domain";
const char *password = "password";
PCF8563 pcf;
// NTP server for time synchronization
const char* ntpServer = "pool.ntp.org";
// Timezone offset (adjust based on your location)
const long gmtOffset_sec = 5.5 * 60 * 60; // Hours * Minutes * Seconds (here, GMT+5:30)
const int daylightOffset_sec = 0; // No daylight saving time assumed
// Global variable to store current time information
static Time nowTime;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200); // Initialize serial communication for debugging
// Set built-in LED pin as output for blinking
pinMode(LED_BUILTIN, OUTPUT);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password); // Connect to WiFi network
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
pcf.init(); // Initialize the PCF8563 real-time clock
// Stop the clock before setting the time
pcf.stopClock();
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
static struct tm timeinfo;
while (!getLocalTime(&timeinfo)) {
Serial.println("no received time info ... Waiting ...");
}
// Set the time on the PCF8563 clock based on retrieved time
pcf.setYear(timeinfo.tm_year);
pcf.setMonth(timeinfo.tm_mon);
pcf.setDay(timeinfo.tm_mday);
pcf.setHour(timeinfo.tm_hour);
pcf.setMinut(timeinfo.tm_min);
pcf.setSecond(timeinfo.tm_sec);
pcf.startClock(); // Start the clock after setting the time
Serial.println("WiFi connected at " + WiFi.localIP());
xTaskCreate(
printDateAndTime,
"Print Uart",
configMINIMAL_STACK_SIZE * 2,
(void*)1,
tskIDLE_PRIORITY,
NULL);
xTaskCreate(
updateTime,
"Get LocalTime",
configMINIMAL_STACK_SIZE * 2,
(void*)1,
tskIDLE_PRIORITY + 1,
NULL);
}
// Function that will run as a task: Prints current date and time to serial port
void printDateAndTime(void* pvParameters) {
for (;;) {
// Print current time in formatted string (DD/MM/YY\tHH:MM:SS) to serial port
Serial.printf("%02d/%02d/%02d\t%02d:%02d:%02d\n",
nowTime.day, nowTime.month + 1, nowTime.year % 100,
nowTime.hour, nowTime.minute, nowTime.second);
// Delay for 1 second before reading time again
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
// Create tasks for different functionalities
// Function that will run as a task: Reads current time from PCF8563 clock
void updateTime(void* pvParameters) {
for (;;) {
// Update the global `nowTime` variable with the current time from the PCF8563 clock
nowTime = pcf.getTime();
// Delay for 0.5 second before reading time again (can be adjusted for desired update frequency)
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
void loop() {
// put your main code here, to run repeatedly:
// Create tasks for different functionalities
}```
‘’’
Yes, it compiles with no errors, and of course I downloaded the libraries I needed to make this work.