Start a new topic

Broken Values


How to show on display broken numbers? Example 25.5


#include "Nextion.h"

#include "DHT.h"

 


NexText txt_temp = NexText(0, 2, "t0");

NexText txt_umid = NexText(0, 4, "t2");

NexProgressBar j0 = NexProgressBar(0, 6, "j0");


#define DHTPIN 2

#define DHTTYPE DHT22

 

DHT dht(DHTPIN, DHTTYPE);

 


char buffer4[100] = {0};

char buffer5[100] = {0};

uint32_t dual_state;

double temp = 0;

double umid = 0;

double temp_perc = 0;

 


 

 

void setup(void){

    nexInit();

}

void loop(){

  

    temperature();

 

}

 

 

 

 

void temperature(){

 

 

 

  

    j0.setValue(temp_perc);

    txt_temp.setText(buffer4);

    txt_umid.setText(buffer5);

 

    delay(2000);

 

     double umid = dht.readHumidity();

  

     double temp = dht.readTemperature();


    memset(buffer4, 0, sizeof(buffer4));

    itoa(temp, buffer4, 10);

    memset(buffer5, 0, sizeof(buffer5));

    itoa(umid, buffer5, 10);


    temp_perc=(temp/0.5);

}

 

 

 

 


1 Comment

 

Forum has been closed since the Nov. 15, 2017  23:59:59.

Please use new forum nextion.itead.cc