0% found this document useful (0 votes)
16 views2 pages

Control Ledlight Using Arduino Iot Cloud - Ino

Uploaded by

Sanjay K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Control Ledlight Using Arduino Iot Cloud - Ino

Uploaded by

Sanjay K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#include "arduino_secrets.

h"
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/4a065391-e6e7-4392-9a76-b58068a168ed

Arduino IoT Cloud Variables description

The following variables are automatically generated and updated when changes are
made to the Thing

bool led;

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"
const int switch1=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(s1,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 loop() {
ArduinoCloud.update();
// Your code here

/*
Since Led is READ_WRITE variable, onLedChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLedChange() {
// Add your code here to act upon Led change
if(led)
{
digitalWrite(switch1,HIGH);
Serial.println("ON");
}
else
{
digitalWrite(s1,LOW);
Serial.println("OFF");
}
}

You might also like