I'm playing with a mkr wifi 1010 for the first time, I have now got it connected and am looking at the IoT cloud get started project in the hub. I have copied the code but am getting an error.
this is the code:
Sketch generated by the Arduino IoT Cloud Thing "alanslight"
https://create.arduino.cc/cloud/things/e8b65b50-775b-401e-baa6-e318ecdc17fb
Arduino IoT Cloud Properties description
The following variables are automatically generated and updated when changes are made to the Thing properties
bool led;
Properties 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 "thingProperties.h"
#define LED_PIN 2
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
pinMode(LED_PIN, OUTPUT);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
void onledChange(){
digitalWrite(LED_PIN,light);
Serial.print("This Light is " )
if (light){
Serial.println("on");
}else{
Serial.println("off");
}
}
}
void loop() {
ArduinoCloud.update();
// Your code here https://www.locksonline.co.uk/ASEC-85mm-PZ-Lever-Handles-for-uPVC-Doors-242mm.html
}
void onAlanslightChange() {
// Do something
}
void onLedChange() {
// Do something
}
I'm getting "led " was not declared in this scope. what led?
this is what is in my thing properties:
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char THING_ID[] = "e8b65b50-775b-401e-baa6-e318ecdc17fb";
const char SSID[] = SECRET_SSID; // Network SSID (name)
const char PASS[] = SECRET_PASS; // Network password (use for WPA, or use as key for WEP)
void onLedChange();
bool toggle;
int angle;
bool light;
void initProperties(){
ArduinoCloud.setThingId(THING_ID);
ArduinoCloud.addProperty(led, READWRITE, ON_CHANGE, onLedChange);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);