Hello, i am coding a portable thermometer with a LM35 sensor and 9v battery on an Uno board.
I keep getting sensorPin was not declared in this scope error and ive tried loads of variations through search forums and ive checked other similar code but i still cant get it to verify correctly, any help is appreciated!
void setup() {
// put your setup code here, to run once:
#include<LiquidCrystal.h>
LiquidCrystal Lcd(12, 11, 5, 4, 3, 2);
const int (sensorPin) = A1;
int sensorValue = analogRead(A1);
Lcd.begin(16, 2); //LCD is 1602, this means 16 columns and 2 rows
Lcd.setCursor(0,0);
Lcd.print (" Temperature ");
Lcd.setCursor(0,1);
Lcd.print( " Celsius Farenhait ");
delay(1000);
Lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
int value = analogRead(sensorPin);
Lcd.setCursor(0,0);
float millivolts = (value / 1024.0)*5000;
float Celsius = millivolts / 10;
Lcd.print (Celsius);
Lcd.print (" degrees Celcius ");
Lcd.print ((Celsius*1.8)+32);
Lcd.print (" degrees Farenhait ");
delay(400); //Temperature at given time will be displayed for 0.4th of a second before a new updated value will be displayed
Lcd.clear();
}