Hi All,
I have a Thing on the IoT Cloud named Device1
.
I have a Device on my Thing also named Device1
.
On my Thing, i created a Variable called Pump
.
A sketch was generated automatically when the variable was created.
At the bottom of the sketch, after loop()
, there is a function called onPumpChange()
.
The whole sketch is like this:
#include "thingProperties.h"
void setup() {
Serial.begin(9600);
delay(1500);
pinMode(7, OUTPUT);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo(); }
void loop() {
ArduinoCloud.update(); }
void onPumpChange() {
if(pump = true) {
digitalWrite(7, HIGH); }
if(pump = false) {
digitalWrite(7, LOW);} }
I created a Dashboard called Greenhouse
.
In this dashboard, i have a single ON/OFF switch, called Pump
- the same name as the variable Pump
, associate with Device1
. The switch called Pump
is linked to the variable called Pump
.
It ran fine the very first time.
Subsequently, after some code edits, the Dashboard switch keeps turning OFF by itself. The Pin 7 digital output never triggers anymore. The relay connected does not activate.
I deleted everything and rebuilt from scratch 3 times. It never worked again - other than that very first time.
I am confounded. I can't spot my mistake.
Is there a way for me to share my code via a link to my account? I am new to this.
This kit is intended to trigger the misting pump in my greenhouse when the humidity falls below a setpoint.
I would be most grateful for any help I can get.
Ashok,