Hi, I am quite new to this and would appreciate help. Can someone assist me with the code to connect an NB1500 with a connected XC4520 (temp and humidity sensor) to the Arduino IOT Cloud? Thanks in advance!
Hi there, anyone out there able to help?
Hello
Post your current sketch.
Paul,
Thanks for your reply. I am actually at a complete loss. I have added the xc4520 to pin11. I have been able to read the temp and humidity to the serial port, but have no idea how to translate that to the cloud. I have been able (by following the guides), to add my device to the cloud, and can see the device online, but I get stuck after the basics.
Therefore, beyond the basics, there is not much I can show you.
Thanks for your help
Paul,
Please see my coding below. This is just the latest of a string of things I have tried. I managed to get the Temp and Humidity displayed in the serial monitor, and can see that my unit is connecting to the cloud, but it is not updating the variable (things).
// SimpleDHT - Version: 1.0.13
#include <SimpleDHT.h>
#include <MKRNB.h>
int pinDHT11 = 11;
SimpleDHT11 dht11(pinDHT11);
unsigned long millisCounter;
/*
Sketch generated by the Arduino IoT Cloud Thing "Mirrabook"
https://create.arduino.cc/cloud/things/6b947be6-eb73-4615-8c06-2e733671dab5
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
float humidity;
float temperature;
bool waterPump;
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"
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
pinMode(12,OUTPUT);//Water pump PINMODE
dht11.read((floattemperature);
delay(1500);
// 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();
//Water pump
digitalWrite(12,waterPump);
//Humidity and temperature
if(millis()-millisCounter>3000){
temperature =dht11.readTemperature(); // Read temperature as Celsius
humidity =dht11.readHumidity(); //Read Humidity
}}
Anyone else there willing to help?
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.