Good Afternoon everyone, i'm working on a little project and i'm trying to make two codes run at the same time, i want the first one to read and display the data of that the sensor of the second code detects in a lcd display but i'm running into this error : exit status 1 redefinition of 'void setup()'
code:
'''
const int PINO_SENSOR = A0;
const int PINO_RELE = 2;
int leitura_sensor = 0;
bool pausa = true;
const int VALOR_MAXIMO = 900; //Valor com solo seco
const int VALOR_MINIMO = 700; //Valor com solo umido
const int CONCENTRACAO_MINIMA = 30;
const int CONCENTRACAO_MAXIMA = 50;
void setup()
{
pinMode(PINO_SENSOR, INPUT);
pinMode(PINO_RELE, OUTPUT);
digitalWrite(PINO_RELE, LOW);
}
void loop() {
leitura_sensor = analogRead(PINO_SENSOR);
leitura_sensor = map(leitura_sensor, VALOR_MINIMO, VALOR_MAXIMO, 100, 0);
if(leitura_sensor < CONCENTRACAO_MINIMA){ //Se sim
digitalWrite(PINO_RELE, HIGH); //Acionamos o rele
pausa = false;
} else if (leitura_sensor > CONCENTRACAO_MAXIMA) { //Caso contrario
digitalWrite(PINO_RELE, LOW);
pausa = true;
}
if(pausa){ //Se sim
delay(10000); //A linha acima aguarda 10 segundos para uma nova leitura
}
}
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7,8,9,10,11,12);
int potPin1 = A1;
int potPin2 = A2;
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.clear();
pinMode(potPin1, INPUT);
pinMode(potPin2, INPUT);
lcd.setCursor(0,0); // Sets the cursor to col 0 and row 0
lcd.print("SensorVal1: "); // Prints Sensor Val: to LCD
lcd.print(analogRead(potPin1)); // Prints value on Potpin1 to LCD
lcd.setCursor(0,1); // Sets the cursor to col 1 and row 0
lcd.print("SensorVal2: "); // Prints Sensor Val: to LCD
lcd.print(analogRead(potPin2)); // Prints value on Potpin1 to LCD
'''