"Smart Greenhouse" Code with Confusing Errors

Working on this (more complicated that originally intended) code for a smart greenhouse with a student, and there are a few persistent errors we're having trouble with. Any help is appreciated.

//libraries
#include <DHT.h>  // Grove DHT11 Temp & Hum sensor
#include <gravity_soil_moisture_sensor.h> 
#include <Servo.h>
#include <PERIPUMP.h>
#include <ADT7470.h>

//Declare Variables
//const
    #define SayCheese A0 	    //Photo Resistor
    #define Quench A1	        //Soil Moisture Sensor 1
    #define Drench A2	        //Soil Moisture Sensor 2
    #define reallyBright 13 	//Light Relay
    #define reallyWet 12	    //Pump Relay
    #define reallyWindy 11	  //Fan Relay
    #define DHTPIN 10 	          //Temp & Humid Sensor
    #define DHTTYPE DHT11     // DHT 11
    DHT dht(DHTPIN, DHTTYPE);
    #define Servo  6 	        //Servo “SpinningAlarm”
    #define Siren 4 	      	//Piezo
                            //Ranges Defined
    #define TempRangeHigh 70	//How hot it can get
    #define TempRangeLow 60 	//How cold it can get
    #define WetRangeHigh 0	  //How Wet it can get **Need Range**
    #define WetRangeLow 0 	  //How Dry it can get **Need Range**
    #define HumiRangeHigh 0	  //How Wet air can get **Need Range**
    #define HumiRangeLow  0	  //How Dry air can get **Need Range**
    #define LightThreshold  0	//Minimum Brightness Required **Need Range**
//float
    float Howt = 0;
    float HowHumid  = 0;
    float HowBright = 0; 
    float Howetone = 0;
    float HoWeTwo = 0;
//int
    int Alarms = 0;
    int IsLightOn = 0;
    int PumpWater = 0;
    int BeenWatered = 0; //delay to water again
    int HowThirsty = 0;
    int HowThirsty1 = 0;
    int HowThirsty2 = 0;
    int FanLevel = 0;
    // Range Variables
    int TempVeryHi = TempRangeHigh + 10;
    int TempVeryLow = TempRangeLow - 10;
    int MoistVeryHi = WetRangeHigh + 10;    //**Adjust to range **
    int MoistVeryLow = WetRangeLow - 10;  //**Adjust to range **
    int HumiVeryHi = HumiRangeHigh + 10;
    int HumiVeryLow = HumiRangeLow - 10;
    //int NormalRange = NormalValue

//Code with ^those^ included
voidSetup(){
  Serial.begin(9600);
  dht.begin();
} //End Void Setup

voidLoop(){
  
  CheckWeather //Read Sensors
  SoundTheAlarm //Alert Gardener
  PrintObservations //Weather Report
  DoSomethingAboutIt //Water, Vent, or take other action
  LightCycle //Keep track & Make sure plants get right amount of light
  AirControl // Adjust Fan Speeds
  Delay //Keep things running at the right speed (maybe fancy to allow snooze)
} //End voidLoop

voidReadSensors(){
  HowBright = SayCheese; // Read value from PhotoResistor
  Howetone = Quench; //Soil Moisture Sensor 1
  HoWeTwo = Drench; //Soil Moisture Sensor 2
  float HowHumid = dht.readHumidity();
  float Howt = dht.readTemperature(true); // Read temperature as Fahrenheit 
} //End Read Sensors

voidPrintObservations(){
  Serial.print("Temperature");
  Serial.println(Howt);
  Serial.print("Humidity:  ");
  Serial.println(HowHumid);
  Serial.print("Brightness Level:  "); //CinnamonToastCrunch 
  Serial.println( HowBright);
  Serial.println();
  Serial.print("Soil Moisture (sensor 1):  ");
  Serial.println(Howetone);
  Serial.print("Soil Moisture (sensor 2):  ");
  Serial.println(HoWeTwo); 
} //End Print

VoidCheckWeather(){
  if(SayCheese<LightThreshold){
    IsLightOn=0;
    }	//Check Lighting
  if(Howetone<MoistRangeLow){
    HowThirsty1=1;
    }	//Water Check 1
  if(Howetone<MoistVeryLow){
    HowThirsty1=2;
    }
  if(HoWeTwo<MoistRangeLow){
    HowThirsty1=1;
    } 
  if(HoWeTwo<MoistVeryLow){
    HowThirsty2=2;
    }
  HowThirsty = HowThirsy1+HowThirsty2;
  if(HowThirsty>1){PumpWater = 1;}
  if(Howetone>MoistVeryHigh){
    PumpWater = 0;
    Alarms++;
    }
  if(HoWeTwo>MoistVeryHigh){
    PumpWater = 0;
    Alarms++;
    }
  if(Howt>TempRangeHigh){FanLevel++;} 	//Temp Check
  if(Howt>TempVeryHi){FanLevel++;Alarms++;}
  if(Howt>TempRangeLow){FanLevel = FanLevel - 1;} 	//Temp Check
  if(Howt>TempVeryLow){FanLevel++;Alarms++;}
} //End Weath-er Check
voidPrintConclusions(){					//Say what Arduino decides to do


}
voidSoundTheAlarm(){					//**Fill This** 
//Turn on the alarms if “bad”
//Keep alarms off if “good”
} //End Alarm
voidDoSomethingAboutIt(){				//Re-Do all of this one
// Temperature
}
// Moisture
If(HowThirsty>[ 
]){
Lights = 5/5 
Fan = 1
}
 
} //End Do Something About It


//* Normal 
//Lights ⅘
//Fan = on but slow
//Water = off 
//HowBright = 4/Max	

//voidLightCycle						//Needs work
//Variables for:
//HowBright (the sensor)
//SayCheese (value of the sensor)
//IsLightOn (
//time light should be on per day
//Time light should be off per day
//Is light on when it is told to be on?


voidAirControl(){						//Turn on Fan at this speed


}

Error messages:

D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:54:13: error: expected constructor, destructor, or type conversion before ';' token
 voidSetup(){
             ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:59:12: error: expected constructor, destructor, or type conversion before ';' token
 voidLoop(){
            ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:70:19: error: expected constructor, destructor, or type conversion before ';' token
 voidReadSensors(){
                   ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:78:25: error: expected constructor, destructor, or type conversion before ';' token
 voidPrintObservations(){
                         ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:92:20: error: expected constructor, destructor, or type conversion before ';' token
 VoidCheckWeather(){
                    ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:123:24: error: expected constructor, destructor, or type conversion before ';' token
 voidPrintConclusions(){     //Say what Arduino decides to do
                        ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:127:21: error: expected constructor, destructor, or type conversion before ';' token
 voidSoundTheAlarm(){     //**Fill This**
                     ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:131:26: error: expected constructor, destructor, or type conversion before ';' token
 voidDoSomethingAboutIt(){    //Re-Do all of this one
                          ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino: In function 'int voidLoop()':
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:61:3: error: 'CheckWeather' was not declared in this scope
   CheckWeather //Read Sensors
   ^~~~~~~~~~~~
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino: In function 'int VoidCheckWeather()':
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:96:15: error: 'MoistRangeLow' was not declared in this scope
   if(Howetone<MoistRangeLow){
               ^~~~~~~~~~~~~
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:96:15: note: suggested alternative: 'WetRangeLow'
   if(Howetone<MoistRangeLow){
               ^~~~~~~~~~~~~
               WetRangeLow
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:102:14: error: 'MoistRangeLow' was not declared in this scope
   if(HoWeTwo<MoistRangeLow){
              ^~~~~~~~~~~~~
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:102:14: note: suggested alternative: 'WetRangeLow'
   if(HoWeTwo<MoistRangeLow){
              ^~~~~~~~~~~~~
              WetRangeLow
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:108:16: error: 'HowThirsy1' was not declared in this scope
   HowThirsty = HowThirsy1+HowThirsty2;
                ^~~~~~~~~~
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:108:16: note: suggested alternative: 'HowThirsty1'
   HowThirsty = HowThirsy1+HowThirsty2;
                ^~~~~~~~~~
                HowThirsty1
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:110:15: error: 'MoistVeryHigh' was not declared in this scope
   if(Howetone>MoistVeryHigh){
               ^~~~~~~~~~~~~
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:110:15: note: suggested alternative: 'MoistVeryHi'
   if(Howetone>MoistVeryHigh){
               ^~~~~~~~~~~~~
               MoistVeryHi
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:114:14: error: 'MoistVeryHigh' was not declared in this scope
   if(HoWeTwo>MoistVeryHigh){
              ^~~~~~~~~~~~~
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:114:14: note: suggested alternative: 'MoistVeryHi'
   if(HoWeTwo>MoistVeryHigh){
              ^~~~~~~~~~~~~
              MoistVeryHi
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino: At global scope:
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:135:3: error: expected constructor, destructor, or type conversion before '(' token
 If(HowThirsty>[
   ^
D:\TomsClasses\Arduino\Luke\Greenhouse\Greenhouse_draft_03_02\Greenhouse_draft_03_02.ino:141:1: error: expected declaration before '}' token
 } //End Do Something About It
 ^

exit status 1

Compilation error: expected constructor, destructor, or type conversion before ';' token

A few areas of code are obviously incomplete, but we've commented them out, or otherwise made them passive.
Thanks!

Start by taking void off setup() and loop(), these are predefined. Next it appears you want functions that do not return a value. Put a space between void and the function name.

I have no clue what you are trying to do with

If(HowThirsty>[ 
]){

Welcome to the forum

Some spaces appear to have gone missing from your code between the void return type specifiers and the function names

Once that is fixed the compiler will not like the uppercase letters of the Loop() and Setup() functions nor the fact that you call functions without a parameter list, even if it is empty

Where did you get the code from ?

Hi,
EVERY void you have like;

voidSetup(){

should be;

void setup(){

void has to be proceeded by SPACE in each occurrence.
Also check spelling, the code is sensitive to capitals and non capitals.

If this amount of code has been written and it does not compile, it seems to me this code has been cut and pasted from another source or written all at once without testing parts of codes in stages.

You cannot write such a large lump of code and expect it to work first off, it will be full of bugs.
Writing the code in stages and testing to get bugs out as you go is much more productive.

You need to write code to
JUST test each type of input hardware and fix any bugs.
JUST to test control over each type of output hardware and fix any bugs.

Then combine them ONE at a time, fixing all bugs before adding the next bit of code.

Tom.. :smiley: :+1: :coffee: :australia:
PS. This might help.

Thanks everyone for the help. This code was written by students from scratch, using another google docs to make teamwork easier. It started as pseudocode, then morphed into this, hence the repeated simple errors.
I think the suggestions given should fix it. (And maybe prevent it in the future).

Any tips for having multiple people working on one piece of code remotely, without needing to constantly copy/paste into IDE to debug?

Which type of course is it?

It's a formal school?

It's an online platform with both formal and informal courses. (Outschool.com)

What's the average age of the students?

Professionals use GIT. But that has a pretty steep learning curve...
It can have multiple development paths and later integrate it (merge).
But still you need to work on different areas of the code. And you need to start from compilable code.

By the way, I would be highly surprised if the spaces will fix all. Usually there are also a few typos a few mismatched {} and a few '=' vs. '=='. But the compiler will tell you once you fixed the spaces...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.