Continuous Dynamic Variable Display

I am trying to take a variable measured every 2.5 seconds from a Qwiic TMP117 and display it at the same interval on a Qwiic Alphanumeric Display. This seems like a simple operation, so I’ve attempted to put two examples together here:

#include <Wire.h>            

#include <SparkFun_TMP117.h> 
TMP117 sensor; 

#include <SparkFun_Alphanumeric_Display.h> 
HT16K33 display;

void setup()
{
  Wire.begin();
  Serial.begin(115200);    
  Wire.setClock(400000);   
  
  if (sensor.begin() == true)
  {
    Serial.println("Begin");
  }
  else
  {
    Serial.println("Error");
    while (1); 
  }
}

void loop()
{
  
  if (sensor.dataReady() == true) 
  {
    float tempC = sensor.readTempC();
    float tempF = sensor.readTempF();
    
    Serial.println(tempF);

    display.print(tempF)
    
    delay(2500); 

  }
}

Please help me!

What is the problem ? What is working what is not working ?

I can get the display to work on its own just printing a string. I can also get the sensor to send readings to the serial port on it’s own. The problem is that when I try to get them to work together with one program, neither works. The same exact functions which I use to make them work separately are in my new program, and I can’t spot any interference between the two.

There is NO display.begin

if (display.begin() == false)
  {
    Serial.println("Device did not acknowledge! Freezing.");
    while (1);
  }
  Serial.println("Display acknowledged.");

That worked!! Mostly…

Here is a sample of my serial feed:

68.46

68.46

68.46

68.46

68.46

68.46

68.48

68.49

My display is only printing the rightmost digit, and it prints it onto the leftmost character of the display. So for example my display shows "9 " for that last reading.

That is progress… you need to do a bit more work to display it correctly ( e.g. using sprintf to turn the value in the right format to display ) look at example6 of the display

GOT IT!! Thanks so much for your help!

Here’s the end product, just FYI:

#include <Wire.h>            

#include <SparkFun_TMP117.h> 
TMP117 sensor; 

#include <SparkFun_Alphanumeric_Display.h> 
HT16K33 display;

void setup()
{
  Wire.begin();
  Serial.begin(115200);    
  Wire.setClock(400000);   
  
  if (sensor.begin() == true)
  {
    Serial.println("Begin");
  }
  else
  {
    Serial.println("Error");
    while (1); 
  }

  if (display.begin() == false)
  {
    Serial.println("Device did not acknowledge! Freezing.");
    while (1);
  }
  Serial.println("Display acknowledged.");
}

void loop()
{
  
  if (sensor.dataReady() == true) 
  {
    float tempC = sensor.readTempC();
    float tempF = sensor.readTempF();
    
    Serial.println(tempF);

    String DispF = String(tempF, 2);

    display.print(DispF);
    
    delay(2500); 

  }
}

COOOL !!! Good to see it works :slight_smile: