Based on @microtherion's comment, I found this:
http://andrey.mikhalchuk.com/2011/06/20/reading-attiny854525-internal-temperature-sensor.htmlThen I tried this:
#include <TinyWireM.h>
#include <LiquidCrystal_I2C.h>
#define GPIO_ADDR 0x27
LiquidCrystal_I2C lcd(GPIO_ADDR,16,2); // set address & 16 chars / 2 lines
void setup(){
TinyWireM.begin(); // initialize I2C lib - comment this out to use with standard arduinos
lcd.init(); // initialize the lcd
lcd.backlight(); // Print a message to the LCD.
analogReference(INTERNAL1V1);
}
int get_temp() {
int raw = analogRead(A0+15);
/* Original code used a 13 Cdeg adjustment. But based on my results, I didn't seem to need it. */
// raw -= 13; // raw adjust = kelvin
int in_c = raw - 273; // celcius
return in_c;
}
void loop(){
int temp = get_temp();
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Intrn Tmp: ");
lcd.print(temp); lcd.print("C");
delay(1000);
}
I was getting readings of around 10C originally, which didn't seem right. So I removed the 13 degree adjustment in Andrey's code (commented line). Adding that back in currently results in a 23C reading, or 73.4F, which is probably about right for this office.
Also, according to Andrey's notes, if you do other analog reads, you might have to reset the internal reference again before taking another temperature reading.