I'm a beginner and I've been getting this error though I removed unnecessary library files and optimized the code to minimum.
#include <Arduino.h>
#include <Wire.h>
#include <vl53l8cx_class.h>
#define SerialPort Serial
#define LPN_PIN A3
#define I2C_RST_PIN -1
#define PWREN_PIN 11
void print_result(VL53L8CX_ResultsData *Result);
void handle_cmd(uint8_t cmd);
void display_commands_banner(void);
VL53L8CX sensor_vl53l8cx_top(&Wire, LPN_PIN, I2C_RST_PIN);
uint8_t res = VL53L8CX_RESOLUTION_4X4;
void setup() {
pinMode(PWREN_PIN, OUTPUT);
digitalWrite(PWREN_PIN, HIGH);
delay(10);
SerialPort.begin(460800);
Wire.begin();
sensor_vl53l8cx_top.begin();
sensor_vl53l8cx_top.init_sensor();
sensor_vl53l8cx_top.vl53l8cx_start_ranging();
}
void loop() {
VL53L8CX_ResultsData Results;
uint8_t NewDataReady = 0;
uint8_t status;
do {
status = sensor_vl53l8cx_top.vl53l8cx_check_data_ready(&NewDataReady);
} while (!NewDataReady);
if ((!status) && (NewDataReady != 0)) {
status = sensor_vl53l8cx_top.vl53l8cx_get_ranging_data(&Results);
print_result(&Results);
}
if (Serial.available()>0) {
handle_cmd(Serial.read());
}
delay(100);
}
void print_result(VL53L8CX_ResultsData *Result) {
// Printing results function remains the same
}
void toggle_resolution(void) {
sensor_vl53l8cx_top.vl53l8cx_stop_ranging();
switch (res) {
case VL53L8CX_RESOLUTION_4X4:
res = VL53L8CX_RESOLUTION_8X8;
break;
case VL53L8CX_RESOLUTION_8X8:
res = VL53L8CX_RESOLUTION_4X4;
break;
default:
break;
}
sensor_vl53l8cx_top.vl53l8cx_set_resolution(res);
sensor_vl53l8cx_top.vl53l8cx_start_ranging();
}
void toggle_signal_and_ambient(void) {
// Toggle signal and ambient functionality remains the same
}
void clear_screen(void) {
// Clearing screen function remains the same
}
void display_commands_banner(void) {
// Displaying commands banner function remains the same
}
void handle_cmd(uint8_t cmd) {
// Handling commands function remains the same
}
````Use code tags to format code for the forum`