anyone can help me to check my coding regarding to my project? actually i am developing temperature sensor using fiber optic and using the Arduino as the conversion medium. what here is my coding but the temeprature display is over the range. i want only until 100 degree Celcius. the voltage range just in millivolts. By the way i am using my own device to replace LM358. the output of the device just the same as LM 358 and i am using pin A0 to connect with Arduino. below is my coding
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int sensor=A1; // Assigning analog pin A1 to variable 'sensor'
float temp; //variable to store temperature in degree Celsius
//float tempf; //variable to store temperature in Fahreinheit
float vout; //temporary variable to hold sensor reading
void setup()
{
pinMode(sensor,INPUT); // Configuring pin A1 as input
//Serial.begin(9600);
lcd.begin(16,2);
delay(500);
}
void loop()
{
vout=analogRead(sensor);
vout=(vout*500)/1023;
temp=vout; // Storing value in Degree Celsius
//tempf=(vout*1.8)+32; // Converting to Fahrenheit
lcd.setCursor(0,0);
lcd.print("Temp = ");
lcd.print(temp);
lcd.setCursor(0,1);
delay(1000); //Delay of 1 second for ease of viewing in serial monitor
}
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int sensor=A1; // Assigning analog pin A1 to variable 'sensor'
float temp; //variable to store temperature in degree Celsius
//float tempf; //variable to store temperature in Fahreinheit
float vout; //temporary variable to hold sensor reading
void setup()
{
pinMode(sensor,INPUT); // Configuring pin A1 as input
//Serial.begin(9600);
lcd.begin(16,2);
delay(500);
}
void loop()
{
vout=analogRead(sensor);
vout=(vout*500)/1023;
temp=vout; // Storing value in Degree Celsius
//tempf=(vout*1.8)+32; // Converting to Fahrenheit
lcd.setCursor(0,0);
lcd.print("Temp = ");
lcd.print(temp);
lcd.setCursor(0,1);
delay(1000); //Delay of 1 second for ease of viewing in serial monitor
}