Hi guys, I'm super new to Arduinos but I'm learning as I go. I'm in the first stages of a small temperature control project and so far I've been able to display the output of a MAX31855 thermocouple breakout board on 124x64 spi OLED through my Arduino micro.
My problem is that the characters of the temperature are corrupted looking. As I think I understand it, the temperature is changing while it's being written to the display therefore you get overlapping values.
I've tried making the temp output an integer but that didn't work.
Any input would be greatly appreciated as I'm just banging my head against the wall.
Here's my code:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_MAX31855.h>
#include <U8glib.h>
//Constructor line for OLED
U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9, 8); // D0=13, D1=11, CS=10, DC=9, Reset=8
// Default connection is using software SPI, but comment and uncomment one of
// the two examples below to switch between software SPI and hardware SPI:
// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXDO 3
#define MAXCS 4
#define MAXCLK 5
// initialize the Thermocouple
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);
// Example creating a thermocouple instance with hardware SPI
// on a given CS pin.
//#define MAXCS 10
//Adafruit_MAX31855 thermocouple(MAXCS);
void draw() {
double c = thermocouple.readCelsius();
u8g.setFont(u8g_font_profont29); // select font
u8g.setPrintPos(5, 45); // set position
u8g.print(c); // display temperature from MAX31855
}
void setup(void) {
}
void loop() {
// picture loop
u8g.firstPage();
do {
draw();
} while (u8g.nextPage());
// rebuild the picture after some delay
delay(5000);
}