0
votes

I am trying to write String to serial in arduino ,

The string has multiple data types :

String sendID=("alarmWithPointer:" + String(12,DEC) ) ;//AlarmOncePointer

and Serial.write(sendID) gives error, so i tried :

 void sendDataSerial(String data)
 {

    int len=data.length()+1;
     char buf[len];
     data.toCharArray(buf, len) ;
     Serial.write(buf);

 }

Which also gives random numbers in the serial .

1

1 Answers

0
votes

Have you tried to use Serial.Print() (ASCII characters) instead of Serial.Write() (binary data)?