How read data from broker

Hello!
I reacived data from broker on arduino uno r3. Topic: “@home:”. Message: “QQWERTYUK”. And print to monitor port arduino.

 if( Serial.available() > 0 )
    {
   hh = Serial.read();
  Serial.print(hh);
      }

But I receiving data in (I think) in dec. “4817066410411110910158818187698284898575” - there my topic and message from broker. How I can receive data in ASCII
Thank you)

Hi Alex,
Where are you receiving the decimal digits. It should print in ASCII itself if you are receiving ASCII.

In code above, we can see, that I received data from Serial and publish to monitor port. Open monitor port on the computer and see data in DEC (4817066410411110910158818187698284898575). But send data from broker Topic: “@home:”. Message: “QQWERTYUK”.

Thats weird :slight_smile: Why is terminal showing data in non ASCII format?
May be your broker itself is sending in that format. Check once using other MQTT tools.

I send from WEBSOCKET UI. Arduino read it and out to Serial monitor Arduino. Also I connect my rs232-USB converter to TX pinout sim800l. I adding picture, what I receive.

Ok. Thats strange. Did you try Serial.write as well ?

I try now to use Serial.write(hh);
But arduino didn’t output data, and also I can’t data see on my parallel connect (RS232-USB converter) to sim800l data from broker. Arduino and rs232 converter (RX pinout) connect together to pinout (TX) sim800l.

Use Serial.write it works, if this fails use Serial.print(hh, HEX)

Thank you for your response.
But problem in another, the variable contains data in hex, non in ASCII. I want read data from broker, and compare it, through strtok. But as we can see above, I get data in HEX or DEC not in ASSIA. And I because of this problem can not compare the data.