So i keep getting an error called: "No RTC available on this architecture - ArduinoIoTCloud will not keep track of local change timestamps ."
i created a variable called Int heartRate in my arduino iot cloud to read from. It's value should be read from 'max30003.heartRate'. My code for heart rate is working perfectly and i can read it on the serial monitor in my arduino IDE for my esp32 its just i cant seem to connect to the internet and i dont know why. below is my main void setup and void loop code along with my header file.
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/05324b4a-f8da-471d-98ad-e64577cee5ed
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int heartRate;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
//#include <ArduinoIoTCloud.h>
//#include <Arduino_ConnectionHandler.h>
#include<SPI.h>
#include "protocentral_Max30003.h"
#include "thingProperties.h"
#define INT_PIN 04
/*
const char DEVICE_LOGIN_NAME[] = "a6c5b279-d867-4415-8643-bdb7d92a1668";
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)
const char DEVICE_KEY[] = SECRET_DEVICE_KEY; // Secret device password
int heartRate;
*/
MAX30003 max30003;
bool rtorIntrFlag = false;
uint8_t statusReg[3];
void rtorInterruptHndlr(){
rtorIntrFlag = true;
}
void enableInterruptPin(){
pinMode(INT_PIN, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(INT_PIN), rtorInterruptHndlr, CHANGE);
}
void setup()
{
Serial.begin(115200); //Serial begin
delay(1500);//delay for serial monitor
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
// setDebufMessageLevel(2);
// ArduinoCloud.printDebugInfo();
pinMode(MAX30003_CS_PIN,OUTPUT);
digitalWrite(MAX30003_CS_PIN,HIGH); //disable device
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
bool ret = max30003.max30003ReadInfo();
if(ret){
Serial.println("Max30003 ID Success");
}else{
while(!ret){
//stay here untill the issue is fixed.
ret = max30003.max30003ReadInfo();
Serial.println("Failed to read ID, please make sure all the pins are connected");
delay(500);
}
}
Serial.println("Initialising the chip ...");
max30003.max30003BeginRtorMode(); // initialize MAX30003
enableInterruptPin();
max30003.max30003RegRead(STATUS, statusReg);
}
/*
void initProperties(){
if(rtorIntrFlag){
rtorIntrFlag = false;
max30003.max30003RegRead(STATUS, statusReg);
if(statusReg[1] & RTOR_INTR_MASK){
max30003.getHRandRR(); //It will store HR to max30003.heartRate and rr to max30003.RRinterval.
Serial.print("Heart Rate = ");
Serial.println(max30003.heartRate);
Serial.print("RR interval = ");
Serial.println(max30003.RRinterval);
}
}
heartRate = max30003.heartRate;
ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
ArduinoCloud.addProperty(heartRate, READ, 2 * SECONDS, NULL);
}
*/
void loop()
{
heartRate = max30003.heartRate;
if(rtorIntrFlag){
rtorIntrFlag = false;
max30003.max30003RegRead(STATUS, statusReg);
if(statusReg[1] & RTOR_INTR_MASK){
max30003.getHRandRR(); //It will store HR to max30003.heartRate and rr to max30003.RRinterval.
Serial.print("Heart Rate = ");
Serial.println(heartRate);
Serial.print("RR interval = ");
Serial.println(max30003.RRinterval);
}
}
ArduinoCloud.update();
}
//WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);
thingProperties.h
// Code generated by Arduino IoT Cloud, DO NOT EDIT.
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
#include "protocentral_Max30003.h"
const char DEVICE_LOGIN_NAME[] = "a6c5b279-d867-4415-8643-bdb7d92a1668";
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)
const char DEVICE_KEY[] = SECRET_DEVICE_KEY; // Secret device password
//MAX30003 max30003;
int heartRate;
void initProperties(){
ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
ArduinoCloud.addProperty(heartRate, READ, 2 * SECONDS, NULL);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);