I have blended the IRtemp sketch (freetronics) and the LiquidCrystal Sketch but I cant seem to get the screen to just show the change in temperature only.
/*
- File: readTemperature.ino
- Author: Andy Gelme (@geekscape) & Angus Gratton (angus at freetronics. com)
- License: GPLv3
- For more information see IR Temperature Sensor Module | Freetronics
*/
#include "IRTemp.h"
#include "LiquidCrystal.h"
LiquidCrystal lcd(12, 11, 9, 8, 7, 6);
static const byte PIN_DATA = 2; // Choose any pins you like for these
static const byte PIN_CLOCK = 3;
static const byte PIN_ACQUIRE = 4;
static const TempUnit SCALE=CELSIUS; // Options are CELSIUS, FAHRENHEIT
IRTemp irTemp(PIN_ACQUIRE, PIN_CLOCK, PIN_DATA);
void setup() {
lcd.begin(16, 2);
// initialize the serial communications:
Serial.begin(9600);
}
void loop() {
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0)
{
// display each character to the LCD
lcd.write(Serial.read());
}
{
float irTemperature = irTemp.getIRTemperature(SCALE);
printTemperature("IR", irTemperature);
}
{
float ambientTemperature = irTemp.getAmbientTemperature(SCALE);
printTemperature("Ambient", ambientTemperature);
delay(1000);
}
{
void printTemperature(char *type, float temperature)
Serial.print(type);
Serial.print(" temperature: ");
if (isnan(temperature)) {
Serial.println("Failed");
}
else {
Serial.print(temperature);
Serial.println(SCALE == FAHRENHEIT ? " F" : " C");
}
}