-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Subject of the issue
Display temperature
Iam just not able to display the temperature given by a sensor in the right position so that the decimal dot position is correct:
Like 25.6 is not displayed as 256. Simple as it should be Iam just not getting it. Maybe someone could give me a hint of what Iam missing (besides the according brains that is ;-) THX!
Your workbench
- ESP32 Thing Plus
- Qwiic alphanumeric display
- ADS122C04_ADC pt 100 temperature sensor
Steps to reproduce
#include <Wire.h>
#include <SparkFun_ADS122C04_ADC_Arduino_Library.h>
#include <SparkFun_Alphanumeric_Display.h>
SFE_ADS122C04 mySensor;
HT16K33 display;
void setup(){
Serial.begin(115200);
Serial.println("StartUp");
Wire.begin();
display.begin();
display.setBrightness(1);
mySensor.begin();
mySensor.configureADCmode(ADS122C04_3WIRE_MODE);
display.print("MOIN");
delay(2500);
}
void loop()
{
float temperature = mySensor.readPT100Centigrade();
Serial.print(F("The temperature is: "));
Serial.print(temperature);
Serial.println(F("C"));
int n = (temperature)*100; // Increase temperature readout by two digits for LED display calculus
int t = (n % 10); // Get the third digit of the temperature readout
int e = (n / 10) % 10; // Get the second digit of the temperature readout
int m = (n / 100) % 10; // Get the first digit of the temperature readout
int p = (n / 1000) % 10; // Get the first increment of the temperature readout
display.print(t, 0);
display.print(e, 1);
display.print(m, 2);
display.printp, 3);
delay(500);
}
Expected behavior
Tell us what should happen
See the correct temperature on the display
Actual behavior
I get some random blinking segments