Cannot update LED status after press switch

Dear Sir

i cannot update Status of LED on Arduino cloud after press switch.
Could you please help me to edit code?

</ '''
CloudLight green;
bool blue;

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 "thingProperties.h"
#include <TridentTD_LineNotify.h>
#define SSID "xxxxxx"
#define PW "xxxxx"
#define Token "xxxxxxx"

void setup() {
Serial.begin(9600);

WiFi.begin(SSID,PW);
pinMode(2,OUTPUT);
digitalWrite(2,LOW);
while (WiFi.status() != WL_CONNECTED) {
delay(100); }

digitalWrite(2,HIGH);
LINE.setToken(Token);

pinMode(22,INPUT_PULLUP);
pinMode(23,OUTPUT);
pinMode(16,INPUT_PULLUP);
pinMode(17,OUTPUT);

delay(1500);

initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}

void loop() {ArduinoCloud.update();}

void onBlueChange() {

if(digitalRead(22) ==HIGH)
{ digitalWrite(23,HIGH);}
else {digitalWrite(23,LOW);}
}

void onGreenChange() {

if(digitalRead(16) ==HIGH)
{digitalWrite(17,HIGH);}
else {digitalWrite(17,LOW);}

}

''' />

example like below

image

Edit your post using the :pencil2: icon and pop your code into the code tags </>
That will help people to help you

There is a good guide here

It is also good to use the IDE auto format to make the code readable

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.