Hello everybody,
It's my 1st time using forum and im pretty new at electronics and programming so please share with me any tips...
I wanted to make a project using NodeMCU v3, to turn LED and its working on PC, but when i downloaded IOT Remote from arduino on my iphone, and wanted to turn that LED on and off, it working but it also turning off that application sometimes it turns off app even if i choose my project, also wanted to ask why my code(will post below) is not showing a temperature on menu in arduino. I want to note that i connected data pin on DHT11 to A0 pin, and still nothing shows up.
If i picked wrong category im sorry :C
I will apreciate all help...
Greetings
Here is the code:
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/dcbef0e9-ed5a-4584-acb7-7a06679d0b98
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
CloudLight led;
CloudTemperatureSensor temperature;
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 "DHT.h"
#define DHTPIN A0
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
pinMode(D5,OUTPUT);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
dht.begin();
// 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();
DHT_SENSOR_READ();
// 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 == 1){
digitalWrite(D5,HIGH);
}
else{
digitalWrite(D5,LOW);
}
}
void DHT_SENSOR_READ()
{
float t = dht.readTemperature();
temperature = t;
Serial.print("Temperature - "); Serial.println(temperature);
delay(1000);
}