How to convert int to string on Arduino?

前端 未结 9 1342
-上瘾入骨i
-上瘾入骨i 2021-01-31 06:32

How do I convert an int, n, to a string so that when I send it over the serial, it is sent as a string?

This is what I have so far:

int ledP         


        
9条回答
  •  生来不讨喜
    2021-01-31 07:21

    You can simply do:

    Serial.println(n);
    

    which will convert n to an ASCII string automatically. See the documentation for Serial.println().

提交回复
热议问题