This is my code. My goal is for the sensor to read the temperature of the water and then print whether it is a good temperature for a plant (hydroponics). I changed the wiring and code several times (using the same materials) but kept getting the same results. Please help me!
//libraries
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS (pin number)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float Celsius = 0;
float Fahrenheit = 0;
//RGB pins
const int redPin = 9;
const int greenPin = 8;
const int bluePin = 7;
int redValue;
int greenValue;
int blueValue;
#include <LiquidCrystal.h> //the liquid crystal library contains commands for printing to the display
LiquidCrystal lcd(12, 11, 6, 5, 4, 3);
const int backlight = 13;
void setup() {
sensors.begin;
Serial.begin(9600);
pinMode(backlight, OUTPUT);
digitalWrite(backlight, HIGH);
lcd.begin(16,2); // the the lcd display we are using a display that is 16 characters wide and 2 characted high
lcd.setCursor (0,0); //set the cursor to the (0,0) position (top left corner - first row and column
} //end of setup
void setColor(int redValue, int greenValue, int blueValue)
{
analogWrite(redPin, redValue);
analogWrite(greenPin, greenValue);
analogWrite(bluePin, blueValue);
} //end of setColor
void loop() {
sensors.requestTemperatures();
Celsius = sensors.getTempCByIndex;
Fahrenheit = sensors.toFahrenheit(Celsius);
Serial.print(Celsius);
Serial.print(“ C “);
Serial.print(Fahrenheit);
Serial.print(“ F “);
delay(1000);
if (Fahrenheit < 60) {
setColor(0, 0, 255);
lcd.print(“Temp : cold”);
lcd.display();
} //end of if
if ((Fahrenheit > 60) && (Fahrenheit < 70)) {
setColor(255, 255, 0);
lcd.print(“Temp: good”);
lcd.display();
} //end of if
if (Fahrenheit > 70) {
setColor(255, 165, 0);
lcd.print(“Temp: hot”);
lcd.display();
} //end of if
} //end of loop