Having trouble displaying a reading on our LCD display. It turns on and when code is uploaded, the LCD display flashes on and off, but no words are printed.
#include <SPI.h>
#include <Wire.h>
#include <LiquidCrystal.h>
#include <max6675.h>
int SO = 7;
int CS = 6;
int CLK = 5;
LiquidCrystal lcd (8,9,10,11,12,13);
MAX6675 temp(CLK,CS,SO);
void setup()
{
Serial.begin(9600);
lcd.begin(16,2);
delay(500);
}
void loop()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Cel.:");
lcd.print(temp.readCelsius());
lcd.print("C");
Serial.print("Cel.:");
Serial.println(temp.readCelsius());
lcd.setCursor(0,1);
lcd.print("Far.:");
lcd.print((temp.readCelsius()*9/5)+32);
lcd.print("F");
Serial.print("Far.:");
Serial.println((temp.readCelsius()*9/5)+32);
delay(1000);
}
/*
Single_Temp.pde - Example using the MAX6675 Library.
Created by Ryan McLaughlin <ryanjmclaughlin@gmail.com>
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
http://creativecommons.org/licenses/by-sa/3.0/
*/
#include <max6675.h>
int LED1 = 9; // Status LED Pin
int CS = 10; // CS pin on MAX6675
int SO = 12; // SO pin of MAX6675
int CLK = 13; // SCK pin of MAX6675
int units = 2; // Units to readout temp (0 = raw, 1 = ˚C, 2 = ˚F)
float temperature = 0.0; // Temperature output variable
// Initialize the MAX6675 Library for our chip
MAX6675 temp(CLK,CS,SO);
// Setup Serial output and LED Pin
// MAX6675 Library already sets pin modes for MAX6675 chip!
void setup() {
Serial.begin(9600);
pinMode(LED1, OUTPUT);
}
void loop() {
// Read the temp from the MAX6675
temperature = temp.readCelsius();
if(temperature < 0) {
// If there is an error with the TC, temperature will be < 0
Serial.print("Thermocouple Error on CS");
Serial.println( temperature );
digitalWrite(LED1, HIGH);
} else {
Serial.print("Current Temperature: ");
Serial.println( temperature );
digitalWrite(LED1, LOW);
}
// Wait one second before reading again
delay(1000);
}