Why does my serial monitor stop working after some modification in the void setup()?
Here's the scenario, I've been trying to make my Temp sensor and LCD works, so when I've coded the necessary 'begin' syntax for those two I'm expecting it work, but then I found out that the serial monitor doesn't even work.
Every time I add that "lcd.begin()" the serial monitor doesn't show anything even if the upload is successful, if there's no "lcd.begin()" the serial monitor works fine.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(32,16,2);
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
#define Temp ({ sensors.requestTemperatures(); float TempReading = sensors.getTempCByIndex(0); Serial.println(TempReading); TempReading; })
void setup()
{
Serial.begin(9600);
sensors.begin();
//lcd.begin();
}
void loop()
{
if (Temp <= 0)
{
Serial.print(" - Fahrenheit temperature: ");
Serial.println(sensors.getTempFByIndex(0));
Serial.println("It's Working!!!");
}
delay(1000);
}