// Code generated by Arduino IoT Cloud
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char DEVICE_LOGIN_NAME[]  = "20aa2c49-1ea3-4425-b907-618205efa539";
const char SSID[]               = "Wokwi-GUEST";    
const char PASS[]               = "";    
const char DEVICE_KEY[]         = "tnOzBbN4gL7kagp7BkD2YWE1x";   
bool button;
bool led;
void initProperties() {
  ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
  ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
  ArduinoCloud.addProperty(button, READWRITE, ON_CHANGE, onButtonChange);
  ArduinoCloud.addProperty(led, READ, ON_CHANGE, NULL);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);
void setup() {
  Serial.begin(9600);
  delay(1500);
  initProperties();
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
  pinMode(26, INPUT_PULLUP);
  pinMode(25, OUTPUT);
}
void loop() {
  ArduinoCloud.update();
  if (!digitalRead(26)) led = true;
  else led = false;
}
void onButtonChange()  {
  if (button) digitalWrite(25, HIGH);
  else digitalWrite(25, LOW);
}