No announcement yet.

Use Decimal on LedDigits with data provided from Arduino

  • Filter
  • Time
  • Show
Clear All
new posts

  • Use Decimal on LedDigits with data provided from Arduino

    Hey people;

    I am building a controlling device with thermostat for an old Jacuzzi.

    The water temperature among other information is processed with an Arduino and needs to be shown on a uLCD-32PT.

    I use Visi Genie to build a nifty and very good looking control panel. (congrats by the way, this is a great peace of software!)

    Water temperature is measured using DS18B20 One wire chip connected to the Arduino.
    This gives me a Float with 2 decimals. I wanted to have at least an 0,1°C accuracy, The DS18B20 even gives more.

    I send this to the uLCD-32PT using the latest AruinoVisiGenie library.
    It works to send the data to the leddigits, but the decimal is ignored, so if the temp is
    22,15 only 22 is shown like this: 00,21 - the decimal 15 seems to be lost.

    this is the snippet of data collecting and sending the temperature to the LCD:
    serial.print is for testing purposes, is works on the serial monitor.
    This function is called whenever I want to read and send the temp to the LCD screen.
    void printTemperature(DeviceAddress deviceAddress){ float tempC = sensors.getTempC(deviceAddress); if (tempC == -127.00) { //Serial.print("Error getting temperature"); } else { //Serial.print("C: "); //Serial.print(tempC); genieWriteObject(GENIE_OBJ_LED_DIGITS, 0x00, tempC); }}_________________________________________________________

    Can you help me, am I overlooking something here?


  • #2


    The decimal on the LED digits is for display only. The number is actually an integer. So if you have one or two decimal places on the display, simply multiply your temperature by 10 or 100 before sending the value and voila!

    eg: genieWriteObject(GENIE_OBJ_LED_DIGITS, 0x00, (tempC * 10));




    • #3

      Works like a charm!
      Tnx for the quick answer.