Below is my code and a picture of the gibberish. It's different every time. If i pull out the temp sensor, i still get gibberish, sometimes. I'm at a loss as to what to even be looking at now. Any ideas?
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//set capacities
int keg1_volume = 19;
int keg2_volume = 19;
const int temperaturePin = 0;
void setup() {
//initial delay
delay(1000);
//set contrast
pinMode(9, OUTPUT);
analogWrite(9, 100);
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print header to the LCD
lcd.setCursor(6, 0);
lcd.print("BeerView");
lcd.setCursor(0,1);
lcd.print("Keg (C)");
lcd.setCursor(10,1);
lcd.print("Keg (F)");
//initialize serial for debugging
Serial.begin(9600);
//get voltage and calculate temp
float voltage, degreesC, degreesF;
voltage = getVoltage(temperaturePin);
degreesC = (voltage - 0.5) * 100.0;
degreesF = degreesC * (9.0/5.0) + 32.0;
//display temp
lcd.setCursor(0,2);
lcd.print(degreesC);
Serial.println(degreesC);
lcd.setCursor(10,2);
lcd.print(degreesF);
Serial.println(degreesF);
}
void loop() {
}
float getVoltage(int pin)
{
return (analogRead(pin) * 0.004882814);
}