Im having problems getting through these errors, i’ve making changes after setting the dashboard on my phone, if i anyone could help me it would be great…
/* 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
bool shutdownButton = 1;
// Moisture variables
int humid1;
int moistureBreakpoint = 60;
bool extractionInProgress = false;
int moistureValueVirtual;
bool extractionButton = 0;
// Temperature variables
int temp1;
int temperatureBreakpointLow = 20;
int temperatureBreakpointHigh = 23;
bool heatingInProgress = false;
bool heatingButton = 0;
// Lighting variables
bool lightingButton = 0;
// 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();
// Outputs
pinMode(D1, OUTPUT); //Output for LED Lighting relay
pinMode(D2, OUTPUT); //Output for Extraction fan relay
pinMode(D3, OUTPUT); //Output for Heater 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 *********************");
shutdownMaster();
moistureMaster();
heatingMaster();
lightingMaster();
Timer = millis();
}
}
void shutdownMaster()
{
Serial.println("------- shutdownMaster started -------");
if(!shutdownButton)
{
startShutdown();
}
// Printing important values
Serial.print("shutdownButton - ");
Serial.println(shutdownButton);
}
void startShutdown()
{
digitalWrite(1, LOW);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
Blynk.virtualWrite(28, 1023);
Serial.println("SHUTDOWN");
}
void moistureMaster()
{
Serial.println("------- moistureMaster started -------");
if((humid1 > moistureBreakpoint) && (!extractionInProgress) && (extractionButton = HIGH))
{
extractionInProgress = true;
startExtraction();
}
if ((humid1 > moistureBreakpoint) && (!extractionInProgress) && (extractionButton = LOW))
{
extractionInProgress = true;
startExtraction();
}
if((humid1 < moistureBreakpoint) && (extractionInProgress) && (extractionButton = HIGH))
{
extractionInProgress = true;
startExtraction();
}
if ((humid1 < moistureBreakpoint) && (extractionInProgress) && (extractionButton = LOW))
{
extractionInProgress = false;
stopExtraction();
}
Serial.print("humid1 - ");
Serial.println(humid1);
Serial.print("extractionInProgress - ");
Serial.println(extractionInProgress);
Serial.print("moistureBreakpoint - ");
Serial.println(moistureBreakpoint);
}
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) && (!heatingButton))
{
heatingInProgress = true;
startHeating();
}
else if((temp1 < temperatureBreakpointLow) && (!heatingInProgress) && (heatingButton))
{
heatingInProgress = false;
stopHeating();
}
else if((temp1 >= temperatureBreakpointHigh) && (heatingInProgress) && (!heatingButton))
{
heatingInProgress = false;
stopHeating();
}
else if((temp1 >= temperatureBreakpointHigh) && (heatingInProgress) && (heatingButton))
{
heatingInProgress = true;
startHeating();
}
Serial.print("temp1 - ");
Serial.println(temp1);
Serial.print("heatingInProgress - ");
Serial.println(heatingInProgress);
Serial.print("temperatureBreakpointLow - ");
Serial.println(temperatureBreakpointLow);
Serial.print("temperatureBreakpointHigh - ");
Serial.println(temperatureBreakpointHigh);
Serial.print("heatingButton - ");
Serial.println(heatingButton);
}
void startHeating()
{
digitalWrite(3, HIGH);
Blynk.virtualWrite(24, 1023);
Blynk.virtualWrite(21, HIGH);
Serial.println("Heating - started");
}
void stopHeating()
{
digitalWrite(3, LOW);
Blynk.virtualWrite(24, 0);
Blynk.virtualWrite(21, LOW);
Serial.println("Heating - stoped");
}
void getTemperature()
{
Blynk.virtualWrite(26, temp1);
}
void LightingMaster()
{
Serial.println("------- heatingMaster started -------");
if(!lightingButton)
{
startLighting();
}
else if(lightingButton)
{
stopLighting();
}
Serial.print("lightingButton - ");
Serial.println(lightingButton);
}
void startLighting()
{
digitalWrite(1, HIGH);
Blynk.virtualWrite(22, 1023);
Serial.println("Lighting - started");
}
void stopLighting();
{
digitalWrite(1, LOW);
Blynk.virtualWrite(22, 0);
Serial.println("Lighting - stopped");
}
// Getting value of moistureBreakpoint
BLYNK_WRITE(V2)
{
int pinData = param.asInt();
moistureBreakpoint = pinData;
}
// Getting value of temperatureBreakpointLow
BLYNK_WRITE(V4)
{
int pinData = param.asInt();
temperatureBreakpointLow = pinData;
}
// Getting value of temperatureBreakpointHigh
BLYNK_WRITE(V5)
{
int pinData = param.asInt();
temperatureBreakpointHigh = pinData;
}
// Getting value of shutdownButton
BLYNK_WRITE(V6)
{
bool pinData = param.asInt();
shutdownButton = pinData;
}
// Getting value of extractionButton
BLYNK_WRITE(V6)
{
int pinData = param.asInt();
extractionButton = pinData;
}
// Getting value of LightingButton
BLYNK_WRITE(V7)
{
bool pinData = param.asInt();
lightingButton = pinData;
}
// Getting value of heatingbutton
BLYNK_WRITE(V8)
{
int pinData = param.asInt();
heatingButton = pinData;
}
void moistureVirtual()
{
Blynk.virtualWrite(20, humid1);
}
errors:
from blynk/BlynkSimpleParticle.h:14,
from blynk/blynk.h:2,
from blynkt.cpp:4:
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:16:1: error: expected unqualified-id before 'else'
else if(lightingButton);
^
blynkt.cpp: In function 'void growBoxMaster()':
blynkt.cpp:131:20: error: 'lightingMaster' was not declared in this scope
}
^
blynkt.cpp: In function 'void LightingMaster()':
blynkt.cpp:290:18: error: 'stopLighting' was not declared in this scope
}
^
blynkt.cpp: At global scope:
blynkt.cpp:305:1: error: expected unqualified-id before '{' token
startLighting();
^
In file included from blynk/BlynkApi.h:17:0,
from blynk/BlynkApiParticle.h:14,
from blynk/BlynkParticle.h:14,
from blynk/BlynkSimpleParticle.h:14,
from blynk/blynk.h:2,
from blynkt.cpp:4:
blynkt.cpp: In function 'void BlynkWidgetWrite6(BlynkReq&, const BlynkParam&)':
This looks like an error in blynk library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
blynk/BlynkHandlers.h:155:10: error: redefinition of 'void BlynkWidgetWrite6(BlynkReq&, const BlynkParam&)'
void BlynkWidgetWrite ## pin (BlynkReq& request, const BlynkParam& param)
^
blynk/BlynkHandlers.h:163:31: note: in expansion of macro 'BLYNK_WRITE_2'
#define BLYNK_WRITE(pin) BLYNK_WRITE_2(pin)
^
blynkt.cpp:345:1: note: in expansion of macro 'BLYNK_WRITE'
^
This looks like an error in blynk library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
blynk/BlynkHandlers.h:155:10: error: 'void BlynkWidgetWrite6(BlynkReq&, const BlynkParam&)' previously defined here
void BlynkWidgetWrite ## pin (BlynkReq& request, const BlynkParam& param)
^
blynk/BlynkHandlers.h:163:31: note: in expansion of macro 'BLYNK_WRITE_2'
#define BLYNK_WRITE(pin) BLYNK_WRITE_2(pin)
^
blynkt.cpp:337:1: note: in expansion of macro 'BLYNK_WRITE'
^
make[1]: *** [../build/target/user/platform-6blynkt.o] Error 1
make: *** [user] Error 2
Error: Could not compile. Please review your code.