data-type-transistion

migrate from https://cmakerhk.wordpress.com/2018/09/28/data-type-transistion/


char *  itoa ( int value, char * str, int base );

itoa() is not officially in compiler, some have that

You can make it official like that:

#inlcude ā€“> itoa

#include ā€“> sprinf

  • sprintf(str,"%d",value) converts to decimal base.
  • sprintf(str,"%x",value) converts to hexadecimal base.
  • sprintf(str,"%o",value) converts to octal base.
Example 

sprintf(disData,ā€%d %d %d %s %s %s %s %s %s %cā€,sound[0],sound[1],sound[2],ppm[0],ppm[1],ppm[2],c_pmDen,c_hum,c_temp,c_alarm);
Serial.println(disData);

//Turn all the data to disData as String!!


ref

http://www.cplusplus.com/reference/cstdio/