I've been following this tutorial closely:
and can't get past step 3: The Sketch
My Code:
#include "thingProperties.h"
#include <Arduino_LSM6DSOX.h>
void setup() {
Serial.begin(9600);
delay(1500);
//define RGB LED as outputs
pinMode(LEDR, OUTPUT);
pinMode(LEDG, OUTPUT);
pinMode(LEDB, OUTPUT);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
//init IMU library
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU!");
while (1);
}
}
void loop() {
ArduinoCloud.update();
//read acceleration and store in a_x, a_y, a_z variables
if (IMU.accelerationAvailable()) {
IMU.readAcceleration(a_x, a_y, a_z);
}
}
/*
the onRgbLightChange() function is triggered
when the rgb_light variable changes
*/
void onRgbLightChange() {
//create r,g,b variables
uint8_t r, g, b;
//retrieve values from the cloud
rgb_light.getValue().getRGB(r, g, b);
//values on Nano RP2040 Connect are inverted
//so let's remap them
int red = map(r, 0, 255, 255, 0);
int green = map(g, 0, 255, 255, 0);
int blue = map(b, 0, 255, 255, 0);
if (rgb_light.getSwitch()) {
analogWrite(LEDR, red);
analogWrite(LEDG, green);
analogWrite(LEDB, blue);
}
else {
analogWrite(LEDR, 255);
analogWrite(LEDG, 255);
analogWrite(LEDB, 255);
}
}
When compiling I get this error:
Start verifying
/tmp/052423176/Watering_mar03a/Watering_mar03a.ino: In function 'void onRgbLightChange()':
/tmp/052423176/Watering_mar03a/Watering_mar03a.ino:56:17: error: 'class CloudColor' has no member named 'getSwitch'
if (rgb_light.getSwitch()) {
^~~~~~~~~
Error during build: exit status 1
/tmp/052423176/Watering_mar03a/Watering_mar03a.ino: In function 'void onRgbLightChange()':
/tmp/052423176/Watering_mar03a/Watering_mar03a.ino:56:17: error: 'class CloudColor' has no member named 'getSwitch'
if (rgb_light.getSwitch()) {
^~~~~~~~~
Error during build: exit status 1
Anything else can I provide in order to get some help?
TIA