Hi people, I have a headache from trying to find the error, could you please help me?
y have this error:
test.ino: In function 'void loop()':
test.ino:136:3: error: a function-definition is not allowed here before '{' token
test.ino:148:3: error: a function-definition is not allowed here before '{' token
test.ino:152:3: error: expected '}' at end of input
Error de compilación
the code:
#include <DallasTemperature.h>
#include <OneWire.h>
#include "RelojDS1307.h"
#include "RTClib.h"
#include <Wire.h>
#include <LiquidCrystal.h>
#define TEMP 7
#define LUZ 8
#define LUZLUNA 4
#define CAL1 5
#define VENT 6
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
OneWire oneWire(TEMP);
DallasTemperature sensors(&oneWire);
DeviceAddress ACUARIO;
RelojDS1307Class Reloj;
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(LUZ, OUTPUT);
pinMode(LUZLUNA, OUTPUT);
pinMode(CAL1, OUTPUT);
pinMode(VENT, OUTPUT);
Serial.print("Localizando sondas de temperatura: ");
Serial.print("Encontradas ");
Serial.print(sensors.getDeviceCount(), DEC);
Serial.println(" sondas.");
lcd.setCursor(4, 0);
lcd.print("ARDUINO WATER");
lcd.setCursor(5, 2);
lcd.print("CICLIDOS");
delay(5000);
//Reloj.SetDateTime( 17, 04, 13, 20, 47, 00 );
}
void loop()
{
Serial.print("Recibiendo temperaturas...");
sensors.requestTemperatures();
Serial.println("OK");
printData(ACUARIO);
float AGUA1 = sensors.getTempC(ACUARIO);
if (AGUA1 < 25)
{
digitalWrite (CAL1, HIGH);
lcd.setCursor(19, 1);
lcd.print("I");
}
if (AGUA1 > 27)
{
digitalWrite (CAL1, LOW);
digitalWrite (VENT, HIGH);
lcd.setCursor(19, 2);
lcd.print("O");
}
if (AGUA1 > 29)
{
digitalWrite (VENT, HIGH);
digitalWrite (LUZ, LOW);
digitalWrite (LUZLUNA, LOW);
lcd.setCursor(19, 3);
lcd.print("V");
}
if (Reloj.IsLater(7, 05) && Reloj.IsPrevious(8, 05))
{
digitalWrite(LUZ, HIGH);
digitalWrite(LUZLUNA, HIGH);
}
else
{
digitalWrite(LUZ, LOW);
digitalWrite(LUZLUNA, LOW);
}
if (Reloj.IsLater(14, 05) && Reloj.IsPrevious(15, 05))
{
digitalWrite(LUZ, HIGH);
digitalWrite(LUZLUNA, HIGH);
}
else
{
digitalWrite(LUZ, LOW);
digitalWrite(LUZLUNA, LOW);
}
if (Reloj.IsLater(17, 05) && Reloj.IsPrevious(23, 05))
{
digitalWrite(LUZ, HIGH);
digitalWrite(LUZLUNA, HIGH);
}
else
{
digitalWrite(LUZ, LOW);
digitalWrite(LUZLUNA, LOW);
}
if (Reloj.IsLater(23, 05) && Reloj.IsPrevious(23, 25))
{
digitalWrite(LUZ, LOW);
digitalWrite(LUZLUNA, HIGH);
}
else
{
digitalWrite(LUZ, LOW);
digitalWrite(LUZLUNA, LOW);
}
if (!sensors.getAddress(ACUARIO, 0))
{
Serial.println("INCAPAZ DE ENCONTRAR SONDA ACUARIO");
lcd.setCursor(0, 1);
lcd.print("FALLO S1");
}
if (sensors.getAddress(ACUARIO, 0))
{
lcd.setCursor(0, 1);
lcd.print("S1 -- OK");
}
void printTemperature(DeviceAddress)
{
float AGUA1 = sensors.getTempC(ACUARIO);
Serial.print("ACUARIO: ");
Serial.print(AGUA1);
Serial.print(" ");
lcd.setCursor(0, 0);
lcd.print(Reloj.DateTime());
lcd.setCursor(0, 2);
lcd.print("ACUARIO: ");
lcd.print(AGUA1);
}
void printData(DeviceAddress)
{
Serial.print(" "); //ver
printTemperature(deviceAddress);
Serial.println();
}