How to display 4 digits with a decimal to a TM1637 LCD Display

Good Afternoon,

I am currently looking into how to display an output onto a TM1637.

Let's say that I have an output I would like to display of 22.44 what would be the best way to achieve it?

Currently I am using the TM1637Display.h library for it.

I am supplying the 4 digit number using float.

Any help would be much appreciated. I will paste all of my code down below:

#include <math.h>
#include <TM1637Display.h>
const int thermistor_output = A1;

#define CLK 10
#define DIO 9

TM1637Display display = TM1637Display(CLK, DIO);


void setup() {
  Serial.begin(9600);  /* Define baud rate for serial communication */

}

void loop() {
  display.setBrightness(7);
  int thermistor_adc_val;
  double output_voltage, thermistor_resistance, therm_res_ln, temperature; 
  thermistor_adc_val = analogRead(thermistor_output);
  output_voltage = ( (thermistor_adc_val * 5.0) / 1023.0 );
  thermistor_resistance = ( ( 5 * ( 10.0 / output_voltage ) ) - 10 ); /* Resistance in kilo ohms */
  thermistor_resistance = thermistor_resistance * 1000 ; /* Resistance in ohms   */
  therm_res_ln = log(thermistor_resistance);
  /*  Steinhart-Hart Thermistor Equation: */
  /*  Temperature in Kelvin = 1 / (A + B[ln(R)] + C[ln(R)]^3)   */
  /*  where A = 0.001129148, B = 0.000234125 and C = 8.76741*10^-8  */
  temperature = ( 1 / ( 0.001129148 + ( 0.000234125 * therm_res_ln ) + ( 0.0000000876741 * therm_res_ln * therm_res_ln * therm_res_ln ) ) ); /* Temperature in Kelvin */
  temperature = temperature - 273.15; /* Temperature in degree Celsius */
  Serial.print("Temperature in degree Celsius = ");
  Serial.print(temperature);
  Serial.print("\t\t");
  Serial.print("Resistance in ohms = ");
  Serial.print(thermistor_resistance);
  Serial.print("\n\n");
  
  // Print 1234 with the center colon:
  float  i = temperature;
  Serial.println(i);
  display.showNumberDec(i); // THIS IS WHERE I WOULD LIKE IT TO DISPLAY THE 4 DIGITS
  
  //display.showNumberDec(temperature, true, 4);
  
  delay(1000);
}

google is your friend

https://www.google.de/search?as_q=TM1637Display.h

look up the hits found by google read the example-codes and write a first own attempt.
if it does not work Describe what the behaviour of your code is or what compiler-error-message you get
and write down a concrete questions.

best regards Stefan

In general most libraries are uploaded to GitHub.
So googling for the libraries filename should find a url at GitHub.

If you are not very familiar with GitHUb

in most cases (but not all!) on GitHub below the file-list on the main-page to this subject
there will be a description how to use it.

If there is no description
watch out for the files with the extensions

*.h and *.cpp

in your case
TM1637Display.h
TM1637Display.cpp

take a look into these files to see what functions are defined.
In most cases the functions names are self-explaining

This initial information should get you going. If you have done these steps and you still have questions
your questions are very welcomed because you put some own effort into learning

best regards Stefan

This is how I did mine when I was playing around with them and it works ok.
Chane this to this and try

//display.showNumberDec(temperature, true, 4);

To this

display.showNumberDecEx(temperature, 0b01000000, false, 4, 0);