0

When i run this code on the arduino i get the following error , "invalid conversion from int to char". What do i need to do to get rid of this error?

int TP_init(){
delay(10);
int measurement=pulseIn (EP, HIGH);  //wait for the pin to get HIGH and   returns measurement
return  (measurement);
writeToFile(int(measurement));
closeFile();
ABD DUDE
  • 21
  • 1
  • 2
  • If the function `writeToFile()` is coming from the [`SDCard_demo.ino`](http://educ8s.com/Arduino/SDCard/SDCard_demo.ino) sample, it is awaiting `char text[]` as input parameter. Don't cast the variable `int measurement` but convert it to a string. – J. Piquard Mar 05 '17 at 13:37
  • 1
    Suggested solution by replacing the code `writeToFile(int(measurement));` by **1)** `String sOut = String(measurement, DEC);` and **2)** `writeToFile(sOut.c_str());`. – J. Piquard Mar 05 '17 at 13:46

0 Answers0