I am trying to figure out how to incorporate a single push button for the I2c that changes the temperature from c to f or f to c? I have looked every where and couldn't find anything..
this is what I have right now, works great...
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
const int sensor=A1; // Assigning analog pin A1 to variable 'sensor'
float tempc; //variable to store temperature Celsius
float tempf; //variable to store temperature Fahreinheit
float vout; //temporary variable to hold sensor reading
void setup()
{
Serial.begin(9600); // Used to type in characters
lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines, turn on backlight
//-------- Write characters on the display ------------------
// NOTE: Cursor Position: (CHAR, LINE) start at 0
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print("Temperature!");
delay(1000);
lcd.setCursor(0,1);
lcd.print("HEAT KILL's");
delay(3000);
pinMode(sensor,INPUT); // Configuring pin A1 as input
lcd.begin(16,2);
}
void loop()
{
vout=analogRead(sensor);
vout=(vout500)/1023;
tempc=vout; // Storing value in Degree Celsius
tempf=(vout1.8)+32; // Converting to Fahrenheit
lcd.setCursor(0,0);
lcd.print("C= ");
lcd.print(tempc);
lcd.setCursor(0,1);
lcd.print("F=");
lcd.print(tempf);
delay(850); //Delay of 1 second for ease of viewing in serial monitor
}
any help would be awesome.