10000 Add files via upload · The-Assembly/Arduino-IOT@1b887fb · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b887fb

Browse files
authored
Add files via upload
1 parent 2051421 commit 1b887fb

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed
Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/*
2-
Sketch generated by the Arduino IoT Cloud Thing "bnb"
3-
https://create.arduino.cc/cloud/things/d4947908-6129-40cb-83b8-4b0a58358ad9
1+
/*
2+
Sketch generated by the Arduino IoT Cloud Thing
43
54
Arduino IoT Cloud Properties description
65
@@ -16,7 +15,7 @@
1615
*/
1716
#include <Adafruit_Sensor.h> //for sensor
1817
#include <DHT.h> //for sensor
19-
#include <DHT_U.h>
18+
#include <DHT_U.h>
2019

2120
#include "thingProperties.h"
2221

@@ -30,55 +29,52 @@ void setup() {
3029
// Initialize serial and wait for port to open:
3130
Serial.begin(9600);
3231
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
33-
delay(1500);
32+
delay(1500);
3433

3534
// Defined in thingProperties.h
3635
initProperties();
3736

3837
// Connect to Arduino IoT Cloud
39-
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
40-
38+
ArduinoCloud.begin(ArduinoIoTPreferredConnection); //initializes Arduino Cloud
39+
4140
/*
4241
The following function allows you to obtain more information
4342
related to the state of network and IoT Cloud connection and errors
4443
the higher number the more granular information you’ll get.
4544
The default is 0 (only errors).
4645
Maximum is 4
47-
*/
46+
*/
4847
setDebugMessageLevel(2);
4948
ArduinoCloud.printDebugInfo();
50-
pinMode(ledPin, OUTPUT);
51-
dht.begin();
52-
49+
pinMode(LEDPIN, OUTPUT);
50+
dht.begin(); //initializes DHT sensor
51+
5352
}
5453

5554
void loop() {
56-
ArduinoCloud.update();
57-
55+
ArduinoCloud.update(); //updates Arduino Cloud to check for values
5856
onTemperatureChange();
5957
onHumidityChange();
60-
6158

6259
}
6360

6461

65-
void onLightChange()
62+
void onLightChange()
6663
{
6764

68-
analogWrite(LEDPIN, light);
65+
analogWrite(LEDPIN, light); //writes the value of 'light' chosen by widget
6966
}
7067

7168

7269
void onTemperatureChange()
7370
{
74-
75-
temperature = dht.readTemperature();
71+
72+
temperature = dht.readTemperature(); //reads the temperature from sensor
73+
//the variable 'temperature' is automatically generated and declared by the cloud
7674
}
7775

7876
void onHumidityChange()
7977
{
80-
humidity = dht.readHumidity();
78+
humidity = dht.readHumidity(); //reads humidity from sensor
79+
//the variable 'temperature' is automatically generated and declared by the cloud
8180
}
82-
83-
84-

0 commit comments

Comments
 (0)
0