lcd.print 中需要有 2 位小数

Need to have 2 decimals in lcd.print

我有这个程序可以通过看门狗中断打印到 LCD。但问题是我需要在秒后保留 2 位小数。

代码如下:

#include <Arduino.h>
#include "DFRobot_RGBLCD.h"
#include <stm32l4xx_hal_iwdg.h>
#include <Wire.h>
#define I2C2_SCL    PB10
#define I2C2_SDA    PB11
DFRobot_RGBLCD lcd(16,2);
TwoWire dev_i2c (I2C2_SDA, I2C2_SCL);
IWDG_HandleTypeDef watchdog;
void Start();
void Pause();
int paused = 0;
int milli = 0;
volatile byte state = HIGH;

void setup() {
  
  pinMode(A2, INPUT_PULLUP);
  pinMode(A3, INPUT_PULLUP);
  lcd.init();
  Serial.begin(9600);
  
  dev_i2c.begin();
  attachInterrupt(A2, Start, FALLING);
  attachInterrupt(A3, Pause,RISING);

  watchdog.Instance = IWDG;
  watchdog.Init.Prescaler = IWDG_PRESCALER_256;
  watchdog.Init.Reload = 1220;
  watchdog.Init.Window = 0x0FFF;

  HAL_IWDG_Init(&watchdog);
  delay(1);
}

void loop() {
  if(state){
    delay(250);
    lcd.setCursor(0, 0);
    lcd.print("Sekunder: ");
    lcd.print(millis()/1000-pause);

    delay(100);
  }
  else{
    delay(1000);
    paused++;
    HAL_IWDG_Refresh(&watchdog);
  }
}
void Start(){
  state = HIGH;
  HAL_IWDG_Refresh(&watchdog);
  delay(10);
}
void Pause(){
  state = !state;
  delay(10);
}

我曾尝试将 -pause 放在 lcd.print 之外,但这没有用。我也试过这个代码行:``` lcd.print(millis()/1000.0, 2-暂停);

But it seems like it takes -paused from the number 2. Do anyone have suggestion to how i can make it work so i get the 2 decimals?
String seconds = String(millis() / 1000.0, 2);
lcd.print(seconds);