Grow box problem

Hello! I’ve been trying to accomplish this project using open source information, so after building the hole hardware part i started looking and found the MeLion grow box project here. The hardware specs are a little different, instead of an intel edison i use parcel photon, instead of a grove moisture sensor and custom temp sensor i am using a DHT11 to sense the temperature and humidity to control the extraction fan and heating. I’ve been trying to compile a code but ran into some errors, im not much of a coder so i tend to alter other projects code to my project.

code:

   // This #include statement was automatically added by the Particle IDE.
    #include "PietteTech_DHT/PietteTech_DHT.h"
   This #include statement was automatically added by the Particle IDE.
    #include "blynk/blynk.h"

    // system defines
    #define DHTTYPE  DHT11              // Sensor type DHT11/21/22/AM2301/AM2302
    #define DHTPIN   2         	    // Digital pin for communications
    #define DHT_SAMPLE_INTERVAL   600  // Sample every minute

    //declaration
    void dht_wrapper(); // must be declared before the lib initialization

    // Lib instantiate
    PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);

    // You should get Auth Token in the Blynk App.
    // Go to the Project Settings (nut icon).
    char auth[] = ""; //Set token from the Blynk app

    char VERSION[64] = "0.04";

    #define READ_INTERVAL 60000

    // My garden setup
     // DHT11 Variables
    unsigned int DHTnextSampleTime;	    // Next time we want to start sample
    bool bDHTstarted;		    // flag to indicate we started acquisition
    int n;                              // counter
      // Moisture variables
    int humid1;
    int moistureBreakpoint = 30;
    bool extractionInverter = 0;
      // Temperature variables
    int temperatureBreakpointLow  = 20;
    int temperatureBreakpointHigh = 22;
    bool heatingInProgress = false;
      // Timer variables
    unsigned long Timer;
    unsigned long milis;


    void setup()
    {
      
      Serial.begin(9600);
      delay(5000);
      Blynk.begin(auth);
      // Or specify server using one of those commands:
      //Blynk.begin(auth, ssid, pass, "server.org", 8442);
      //Blynk.begin(auth, ssid, pass, server_ip, port);

      pinMode(D1, OUTPUT); //Output for Water Pump relay connection
      pinMode(D2, OUTPUT); //Output for Heater relay connection
      pinMode(D3, OUTPUT); //Output for Extraction relay connection
      // Initial timer setup
      Timer = millis();
      
       DHTnextSampleTime = 0;  // Start the first sample immediately

    }


    // This wrapper is in charge of calling
    // must be defined like this for the lib work
    void dht_wrapper() {
        DHT.isrCallback();
    }

        
          Serial.println("done setup");
        }

    void loop()
    {
      Blynk.run();

      // Main function that times and calls all of the other subfunctions
      growBoxMaster();
      
    }

    void growBoxMaster()
    {
      // Check if we need to start the next sample
      if (millis() > DHTnextSampleTime) {
          
    	if (!bDHTstarted) {		// start the sample
    	    DHT.acquire();
    	    bDHTstarted = true;
    	}

     if (!DHT.acquiring()) {		// has sample completed?
      
      milis = millis();
      if(milis - Timer >= 1000UL)
      {
        Serial.println("********************* Timed pseudoloop execution *********************");
        moistureMaster();
        heatingMaster();
        lightMaster();
        Timer = millis();
      }
    }

    void moistureMaster()
    {
      Serial.println("------- moistureMaster started -------");
      
      float humid = (float)DHT.getHumidity();
      int humid1 = (humid - (int)humid) * 100;
      
      char humidInChar[32];
      sprintf(humidInChar,"%0d.%d", (int)humid, humid1);
      

      // Converting moisture to virtual and sending to Blynk
      moistureVirtual();

      // Printing important values
      Serial.print("Moisture value - ");
      Serial.println(humid1);
      Serial.print("moistureBreakpoint - ");
      Serial.println(moistureBreakpoint);
      
      if((humid1 < moistureBreakpoint) && !extractionInverter)
      {
        startExtraction();
      }
      else if (((humid1 < moistureBreakpoint) && extractionInverter))
      {
        stopExtraction();
      }
      else if((humid1 >= moistureBreakpoint) && !extractionInverter)
      {
        stopExtraction();
      }
      else if((humid1 >= moistureBreakpoint) && extractionInverter)
      {
        startExtraction();
      }
      
      Serial.print("extractionInverter - ");
      Serial.println(extractionInverter);
      
    }

    void startExtraction()
    {
      digitalWrite(2, HIGH);
      Blynk.virtualWrite(25, 1023);
      Serial.println("Extraction - started");
    }

    void stopExtraction()
    {
      digitalWrite(2, LOW);
      Blynk.virtualWrite(25, 0);
      Serial.println("Extraction - stoped");
    }

    void heatingMaster()
    {
      Serial.println("------- heatingMaster started -------");

      getTemperature();

      if(temp1 < temperatureBreakpointLow && !heatingInProgress)
      {
        heatingInProgress = true;
        startHeating();
      }
      if(temp1 >= temperatureBreakpointHigh && heatingInProgress) 
      {
        heatingInProgress = false;
        stopHeating();
      }

      Serial.print("temperatureRealValue - ");
      Serial.println(temperatureRealValue);

      Serial.print("heatingInProgress - ");
      Serial.println(heatingInProgress);

      Serial.print("temperatureBreakpointLow - ");
      Serial.println(temperatureBreakpointLow);

      Serial.print("temperatureBreakpointHigh - ");
      Serial.println(temperatureBreakpointHigh);
    }

    void startHeating()
    {
      digitalWrite(3, HIGH);
      Blynk.virtualWrite(24, 1023);
      Serial.println("Heating - started");
    }

    void stopHeating()
    {
      digitalWrite(3, LOW);
      Blynk.virtualWrite(24, 0);
      Serial.println("Heating - stoped");
    }

    void getTemperature()
    {
        float temp = (float)DHT.getCelsius();
      int temp1 = (temp - (int)temp) * 100;

      char tempInChar[32];
      sprintf(tempInChar,"%0d.%d", (int)temp, temp1);
      
      Blynk.virtualWrite(26, tempInChar);
    }


    // Getting value of irigationInverter from virtual pin 1
    BLYNK_WRITE(V1)
    {
      bool pinData = param.asInt();
      extractionInverter = pinData;
    }

    // Getting value of moistureBreakpoint from virtual pin 2
    BLYNK_WRITE(V2)
    {
      int pinData = param.asInt();
      moistureBreakpoint = pinData;
    }

    // Getting value of temperatureBreakpointLow from virtual pin 4
    BLYNK_WRITE(V4)
    {
      int pinData = param.asInt();
      temperatureBreakpointLow = pinData;
    }

    // Getting value of temperatureBreakpointHigh from virtual pin 5
    BLYNK_WRITE(V5)
    {
      int pinData = param.asInt();
      temperatureBreakpointHigh = pinData;
    }

    void moistureVirtual()
    {
      Blynk.virtualWrite(2, humidInChar);
     
    }

      n++;  // increment counter
      bDHTstarted = false;  // reset the sample flag so we can take another
      DHTnextSampleTime = millis() + DHT_SAMPLE_INTERVAL;  // set the time for next sample
    }

errors:

    In file included from blynk/BlynkParticle.h:14:0,
                     from blynk/BlynkSimpleParticle.h:14,
                     from blynk/blynk.h:2,
                     from blynkt.cpp:5:
    blynk/BlynkApiParticle.h:90:6: warning: #warning "analogInputToDigitalPin not defined => Named analog pins will not work" [-Wcpp]
         #warning "analogInputToDigitalPin not defined => Named analog pins will not work"
          ^
    blynkt.cpp:73:13: error: expected constructor, destructor, or type conversion before '.' token
       Timer = millis();
                 ^

    blynkt.cpp:74:5: error: expected declaration before '}' token
       
         ^

    make[1]: *** [../build/target/user/platform-6blynkt.o] Error 1
    make: *** [user] Error 2

if any one could help it worth be great! many thanks!

cheers

EDIT:
this is my first complex project and the code is just adapted so there might be syntax and functioning errors :grin:

2 Likes

BUMP i can’t get this to compile… so close but so far lol plz help!

thank you and sorry! i think it´s right now :slight_smile:

This is going wrong. You see where it’s off? There’s a bracket too much :slight_smile:

1 Like

hey thanks! its this small stupid problems that im not comfortable with… other syntax errors showed up lol trying to work on them.

stupid question: how to locate the erros on the project? anything related to those numbers in the beginning of the error?

oh god so many problems


// This #include statement was automatically added by the Particle IDE.
#include "PietteTech_DHT/PietteTech_DHT.h"

// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"


// system defines
#define DHTTYPE  DHT11              // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPIN   2         	    // Digital pin for communications
#define DHT_SAMPLE_INTERVAL   600  // Sample every minute

//declaration
void dht_wrapper(); // must be declared before the lib initialization

// Lib instantiate
PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = ""; //Set token from the Blynk app

char VERSION[64] = "0.04";

#define READ_INTERVAL 60000

// My garden setup
 // DHT11 Variables
unsigned int DHTnextSampleTime;	    // Next time we want to start sample
bool bDHTstarted;		    // flag to indicate we started acquisition
int n;                              // counter
  // Moisture variables
int humid1;
int moistureBreakpoint = 30;
bool extractionInverter = 0;
  // Temperature variables
int temperatureBreakpointLow  = 20;
int temperatureBreakpointHigh = 22;
bool heatingInProgress = false;
  // Timer variables
unsigned long Timer;
unsigned long milis;


void setup()
{
  
  Serial.begin(9600);
  delay(5000);
  Blynk.begin(auth);
  // Or specify server using one of those commands:
  //Blynk.begin(auth, ssid, pass, "server.org", 8442);
  //Blynk.begin(auth, ssid, pass, server_ip, port);

  pinMode(D1, OUTPUT); //Output for Water Pump relay 
  pinMode(D2, OUTPUT); //Output for Heater relay 
  pinMode(D3, OUTPUT); //Output for Extraction relay 
  // Initial timer setup
  Timer = millis();
  
   DHTnextSampleTime = 0;  // Start the first sample immediately

}


// This wrapper is in charge of calling
// must be defined like this for the lib work
void dht_wrapper() {
    DHT.isrCallback();

    
      Serial.println("done setup");
    }

void loop()
{
  Blynk.run();

  // Main function that times and calls all of the other subfunctions
  growBoxMaster();
  
}

void growBoxMaster()
{
  // Check if we need to start the next sample
  if (millis() > DHTnextSampleTime) {
      
	if (!bDHTstarted) {		// start the sample
	    DHT.acquire();
	    bDHTstarted = true;
	}

 if (!DHT.acquiring()) {		// has sample completed?
  
  milis = millis();
  if(milis - Timer >= 1000UL)
  {
    Serial.println("********************* Timed pseudoloop execution *********************");
    moistureMaster();
    heatingMaster();
    Timer = millis();
  }
}

void moistureMaster()

  Serial.println("------- moistureMaster started -------");
  
  float humid = (float)DHT.getHumidity();
  int humid1 = (humid - (int)humid) * 100;
  
  char humidInChar[32];
  sprintf(humidInChar,"%0d.%d", (int)humid, humid1);
  

  // Converting moisture to virtual and sending to Blynk
  moistureVirtual();

  // Printing important values
  Serial.print("Moisture value - ");
  Serial.println(humid1);
  Serial.print("moistureBreakpoint - ");
  Serial.println(moistureBreakpoint);
  
  if((humid1 < moistureBreakpoint) && !extractionInverter)
  {
    startExtraction();
  }
  else if (((humid1 < moistureBreakpoint) && extractionInverter))
  {
    stopExtraction();
  }
  else if((humid1 >= moistureBreakpoint) && !extractionInverter)
  {
    stopExtraction();
  }
  else if((humid1 >= moistureBreakpoint) && extractionInverter)
  {
    startExtraction();
  }
  
  Serial.print("extractionInverter - ");
  Serial.println(extractionInverter);
  
}

void startExtraction()
{
  digitalWrite(2, HIGH);
  Blynk.virtualWrite(25, 1023);
  Serial.println("Extraction - started");
}

void stopExtraction()
{
  digitalWrite(2, LOW);
  Blynk.virtualWrite(25, 0);
  Serial.println("Extraction - stoped");
}

void heatingMaster()
{
  Serial.println("------- heatingMaster started -------");

  getTemperature();

  if(temp1 < temperatureBreakpointLow && !heatingInProgress)
  {
    heatingInProgress = true;
    startHeating();
  }
  if(temp1 >= temperatureBreakpointHigh && heatingInProgress) 
  {
    heatingInProgress = false;
    stopHeating();
  }

  Serial.print("temperatureRealValue - ");
  Serial.println(temperatureRealValue);

  Serial.print("heatingInProgress - ");
  Serial.println(heatingInProgress);

  Serial.print("temperatureBreakpointLow - ");
  Serial.println(temperatureBreakpointLow);

  Serial.print("temperatureBreakpointHigh - ");
  Serial.println(temperatureBreakpointHigh);
}

void startHeating()
{
  digitalWrite(3, HIGH);
  Blynk.virtualWrite(24, 1023);
  Serial.println("Heating - started");
}

void stopHeating()
{
  digitalWrite(3, LOW);
  Blynk.virtualWrite(24, 0);
  Serial.println("Heating - stoped");
}

void getTemperature()
{
    float temp = (float)DHT.getCelsius();
  int temp1 = (temp - (int)temp) * 100;

  char tempInChar[32];
  sprintf(tempInChar,"%0d.%d", (int)temp, temp1);
  
  Blynk.virtualWrite(26, tempInChar);
}


// Getting value of irigationInverter from virtual pin 1
BLYNK_WRITE(V1)
{
  bool pinData = param.asInt();
  extractionInverter = pinData;
}

// Getting value of moistureBreakpoint from virtual pin 2
BLYNK_WRITE(V2)
{
  int pinData = param.asInt();
  moistureBreakpoint = pinData;
}

// Getting value of temperatureBreakpointLow from virtual pin 4
BLYNK_WRITE(V4)
{
  int pinData = param.asInt();
  temperatureBreakpointLow = pinData;
}

// Getting value of temperatureBreakpointHigh from virtual pin 5
BLYNK_WRITE(V5)
{
  int pinData = param.asInt();
  temperatureBreakpointHigh = pinData;
}

void moistureVirtual()
{
  Blynk.virtualWrite(2, humidInChar);
 
}

  n++;  // increment counter
  bDHTstarted = false;  // reset the sample flag so we can take another
  DHTnextSampleTime = millis() + DHT_SAMPLE_INTERVAL;  // set the time for next sample
}



errors:

In file included from blynk/BlynkParticle.h:14:0,
                 from blynk/BlynkSimpleParticle.h:14,
                 from blynk/blynk.h:2,
                 from blynkt.cpp:5:
blynk/BlynkApiParticle.h:90:6: warning: #warning "analogInputToDigitalPin not defined => Named analog pins will not work" [-Wcpp]
     #warning "analogInputToDigitalPin not defined => Named analog pins will not work"
      ^
blynkt.cpp: In function 'void growBoxMaster()':
blynkt.cpp:100:20: error: 'moistureMaster' was not declared in this scope
   if (millis() > DHTnextSampleTime) {
                    ^

In file included from ./inc/application.h:45:0,
                 from blynkt.cpp:2:
../wiring/inc/spark_wiring_usbserial.h:94:16: error: expected initializer before '_fetch_global_serial'
 #define Serial _fetch_global_serial()
                ^

blynkt.cpp:108:3: note: in expansion of macro 'Serial'
   
   ^
blynkt.cpp:149:1: error: a function-definition is not allowed here before '{' token
     stopExtraction();
 ^

blynkt.cpp:156:1: error: a function-definition is not allowed here before '{' token
   Serial.print("extractionInverter - ");
 ^

blynkt.cpp:163:1: error: a function-definition is not allowed here before '{' token
   digitalWrite(2, HIGH);
 ^

blynkt.cpp:255:1: error: expected '}' at end of input
   int pinData = param.asInt();
 ^

make[1]: *** [../build/target/user/platform-6blynkt.o] Error 1
make: *** [user] Error 2

Well, usually they indicate line number and place in the code on that line (e.g. 60:8 means line 60, 8th character). But, be warned weary traveller! Because it’s so delicate in that sense a typ-o on line 8 can influence the compiler in such a way that it comes with an error on line 20.

You have to look carefully for things like missing brackets, too much, weird end of code of line. Because the compiler can only interpret the way it has learned from its “masters” (e.g. the hum-aans who made it, to quote Quark), they can’t have rules for every contingency. Therefor, debugging is a nasty, time consuming, but unfortunately highly needed task. It sucks, I’ll give you that, but it’s the best way to learn from your own mistakes :wink:

2 Likes

ahah totally! i’ve learnt a lot in a shot time regarding coding, a lot due to blynk and this forum but yeah its hard to learn the basics when you’re so hyped about a project ahah i’m only missing this part :disappointed: ill give it a try! thanks man, you’re always around here helping!

Hey i got it to compile! yay!!

I’m now having trouble to add 3 physical toggle buttons to control the extraction, heating and lighting… i’ve declared them as INPUTS but not really sure how to add to the conditions in moistureMaster and heatingMaster and set a condition regarding the lighting ( relay output D3)

code

/* MeLion GrowBox 0.1 */
// This #include statement was automatically added by the Particle IDE.
#include "PietteTech_DHT/PietteTech_DHT.h"
#include "blynk/blynk.h"
// system defines
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#define DHTTYPE  DHT11              // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPIN   0         	    // Digital pin for communications
#define DHT_SAMPLE_INTERVAL   600  // Sample every minute
//declaration
void dht_wrapper(); // must be declared before the lib initialization

// Lib instantiate
PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);

// globals
unsigned int DHTnextSampleTime;	    // Next time we want to start sample
bool bDHTstarted;		    // flag to indicate we started acquisition
int n;                              // counter
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = ""; //Set token from the Blynk app

char VERSION[64] = "0.04";

#define READ_INTERVAL 60000

// My garden setup
  // Moisture variables
int humid1;
int moistureBreakpoint = 30;
bool extractionInverter = 0;
int moistureValueVirtual;
  // Temperature variables
int temp1;
int temperatureBreakpointLow  = 20;
int temperatureBreakpointHigh = 22;
bool heatingInProgress = false;
  // Timer variables
unsigned long Timer;
unsigned long milis;

void setup()
{
  
  Serial.begin(9600);
  delay(5000);
  Blynk.begin(auth);

 DHTnextSampleTime = 0;  // Start the first sample immediately

}


// This wrapper is in charge of calling
// must be defined like this for the lib work
void dht_wrapper() {
    DHT.isrCallback();

// Inputs
  pinMode(A1, INPUT); //Input for Extraction button
  pinMode(A2, INPUT); //Input for Heating button
  pinMode(A3, INPUT); //Input for Lighting button
// Outputs
  pinMode(1, OUTPUT); //Output for Extraction Fan relay 
  pinMode(2, OUTPUT); //Output for Heater relay 
  pinMode(3, OUTPUT); //Output for Led Lighting relay 
  
  
  // Initial timer setup
  Timer = millis();

  Serial.println("done setup");
}

void loop()
{
  Blynk.run();

 // Check if we need to start the next sample
  if (millis() > DHTnextSampleTime) {
      
	if (!bDHTstarted) {		// start the sample
	    DHT.acquire();
	    bDHTstarted = true;
	}

 if (!DHT.acquiring()) {		// has sample completed?

  float temp = (float)DHT.getCelsius();
  int temp1 = (temp - (int)temp) * 100;

  char tempInChar[32];
  sprintf(tempInChar,"%0d.%d", (int)temp, temp1);



  float humid = (float)DHT.getHumidity();
  int humid1 = (humid - (int)humid) * 100;
  
  char humidInChar[32];
  sprintf(humidInChar,"%0d.%d", (int)humid, humid1);
  
  // Converting moisture to virtual and sending to Blynk
  moistureVirtual();
 

  n++;  // increment counter
  bDHTstarted = false;  // reset the sample flag so we can take another
  DHTnextSampleTime = millis() + DHT_SAMPLE_INTERVAL;  // set the time for next sample
 }
 
}

 

  // Main function that times and calls all of the other subfunctions
  growBoxMaster();
  
}

void growBoxMaster()
{
  milis = millis();
  if(milis - Timer >= 1000UL)
  {
    Serial.println("********************* Timed pseudoloop execution *********************");
    moistureMaster();
    heatingMaster();
    Timer = millis();
  }
}

void moistureMaster()
{
  Serial.println("------- moistureMaster started -------");
  


  // Printing important values
  Serial.print("humid1 - ");
  Serial.println(humid1);
  Serial.print("moistureBreakpoint - ");
  Serial.println(moistureBreakpoint);
  
  if((humid1 < moistureBreakpoint) && !extractionInverter)
  {
    startExtraction();
  }
  else if (((humid1 < moistureBreakpoint) && extractionInverter))
  {
    stopExtraction();
  }
  else if((humid1 >= moistureBreakpoint) && !extractionInverter)
  {
    stopExtraction();
  }
  else if((humid1 >= moistureBreakpoint) && extractionInverter)
  {
    startExtraction();
  }
  
  Serial.print("extractionInverter - ");
  Serial.println(extractionInverter);
  
}

void startExtraction()
{
  digitalWrite(1, HIGH);
  Blynk.virtualWrite(25, 1023);
  Serial.println("Extraction - started");
}

void stopExtraction()
{
  digitalWrite(1, LOW);
  Blynk.virtualWrite(25, 0);
  Serial.println("Extraction - stoped");
}

void heatingMaster()
{
  Serial.println("------- heatingMaster started -------");

  getTemperature();

  if(temp1 < temperatureBreakpointLow && !heatingInProgress)
  {
    heatingInProgress = true;
    startHeating();
  }
  if(temp1 >= temperatureBreakpointHigh && heatingInProgress) 
  {
    heatingInProgress = false;
    stopHeating();
  }

  Serial.print("temp1 - ");
  Serial.println(temp1);

  Serial.print("heatingInProgress - ");
  Serial.println(heatingInProgress);

  Serial.print("temperatureBreakpointLow - ");
  Serial.println(temperatureBreakpointLow);

  Serial.print("temperatureBreakpointHigh - ");
  Serial.println(temperatureBreakpointHigh);
}

void startHeating()
{
  digitalWrite(2, HIGH);
  Blynk.virtualWrite(24, 1023);
  Serial.println("Heating - started");
}

void stopHeating()
{
  digitalWrite(2, LOW);
  Blynk.virtualWrite(24, 0);
  Serial.println("Heating - stoped");
}

void getTemperature()
{
  
  Blynk.virtualWrite(26, temp1);
}

// Getting value of extractionInverter from virtual pin 1
BLYNK_WRITE(V1)
{
  bool pinData = param.asInt();
  extractionInverter = pinData;
}

// Getting value of moistureBreakpoint from virtual pin 2
BLYNK_WRITE(V2)
{
  int pinData = param.asInt();
  moistureBreakpoint = pinData;
}

// Getting value of temperatureBreakpointLow from virtual pin 4
BLYNK_WRITE(V4)
{
  int pinData = param.asInt();
  temperatureBreakpointLow = pinData;
}

// Getting value of temperatureBreakpointHigh from virtual pin 5
BLYNK_WRITE(V5)
{
  int pinData = param.asInt();
  temperatureBreakpointHigh = pinData;
}

void moistureVirtual()
{
  Blynk.virtualWrite(23, humid1);

}

cheers!

@bernas_123 by physical “toggle” buttons do you means momentary switches?

Read the button status, set a global variable and check the value of the global variable in your moistureMaster and heatingMaster functions.

See Wemos d1 & blynk for a sample sketch that uses interrupts for button presses (probably worth you reading the whole thread).

thank you, going to check it out! i was thinking of using momentary pushbuttons but i think its easier to use switches

is this correct? i want to add a switch or a button (the easiest way) just to check if things are working, for the lights, fans and heating and resume the operations when i switch off or press again, no matter what the temp and humidity are

int heatingButton 

...
 pinMode(A2, INPUT); //Input for heating button

...

void heatingMaster()
{
  Serial.println("------- heatingMaster started -------");

  getTemperature();

  if(temp1 < temperatureBreakpointLow && !heatingInProgress && heatingButton = HIGH)
  {
    heatingInProgress = true;
    startHeating();
  }
 if(temp1 < temperatureBreakpointLow && !heatingInProgress && heatingButton = LOW)
  {
    heatingInProgress = false;
    stopHeating();
  }
  if(temp1 >= temperatureBreakpointHigh && heatingInProgress && heatingButton = LOW) 
  {
    heatingInProgress = false;
    stopHeating();
  }

No it is not.

  if((temp1 < temperatureBreakpointLow) && (!heatingInProgress) && (heatingButton == HIGH))
  {
    heatingInProgress = true;
    startHeating();
  }
 if((temp1 < temperatureBreakpointLow) && (!heatingInProgress) && (heatingButton == LOW))
  {
    heatingInProgress = false;
    stopHeating();
  }
  if((temp1 >= temperatureBreakpointHigh) && (heatingInProgress) && (heatingButton == LOW)) 
  {
    heatingInProgress = false;
    stopHeating();
  }

Not = but ==, if you put = you are set one variable to equal another variable as opposed to comparing them. I also like to see brackets around each condition.

Try it and see how it goes.

i think i got it, it compiles well!

another question: I’m thinking of using the rtc widget to set a schedule for the lighting but i haven’t stated any function like for the other “masters” since I’ll be sending directly to the digital pin of the relay, how can i set a led widget when the relay is HIGH?

is anything like this?

bool ledRelayState = 0

...

void LightingMaster()
{
Blynk.virtualWrite(23, ledRelayState);
}

BLYNK_WRITE(V1){
    if (param.asInt()){       
        digitalWrite(ledRelayState, HIGH);
    } else {
        digitalWrite(ledRelayState, LOW);
    }
}

many thanks for all the help guys, I’ll be posting pictures of the setup soon:slight_smile:

You need a ; after = 0 but even though bools represent 0 and 1 they are referenced as false and true, so it would be:

bool ledRelayState = false;

Which virtual pin is the LED on and what is V1 and V23?

Doesn’t quite look right.

Combine them, even easier :wink:

BLYNK_WRITE(V1){
    if (param.asInt()){       
        digitalWrite(ledRelayState, HIGH);
        Blynk.virtualWrite(23, HIGH);
    } else {
        digitalWrite(ledRelayState, LOW);
        Blynk.virtualWrite(23, LOW);
    }
}

V1 would be the input from the rtc widget and v23 would be the output for the led widget, i think that @Lichtsignaal did it! Im going to try it! Thanks guys! Really apreciated your help!

The RTC widget, if you use the Blynk one instead of a hardware one, is a different story, but yes. I prefer to use virtual pins because you are much more flexible in what you do. You can set for example two relays high with one button.

Yeah Vpins rock, im starting to realize the potential in them and im going to make a few changes in the project to simplify things. What do you mean regarding blynks rtc widget? I e as planning to use the input from it and give it to a function to close or open a relay…