0

enter image description here

When I run the code, I get an Invalid conversion from 'int' to 'char*' [-fpermissive] error, and I cannot figure out what's wrong.

I'm new to arduino and I have this project and I cannot understand a single thing.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • 2
    Please do not post images of code/errors/data. Instead post the code/errors/data as text in a code block. See [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) – Scratte May 26 '21 at 23:46

1 Answers1

1

The error indicates that the compiler cannot cast int to char*. The reason is that coulourDistance is of type 'int' and SAMPLES[i][4] seems to be a 'char*' (i.e. a string) - tell me if I'm wrong! If so, the error comes from the assignment SAMPLES[i][4] = coulourDistance;. You can replace it with sprintf(SAMPLES[i][4], "%d", coulourDistance); as explained in this post I use sprintf as follows

elbe
  • 1,363
  • 1
  • 9
  • 13