Good time everyone!
Please help me figure out the code.
Task: push the sensor value into UART in hex format in the amount of two bytes.
I am using the following code:
- uart.write: !lambda
charbuf[128];
sprintf(buf, "%X", 400);
std::string s = buf;
return std::vector<unsigned char>( s.begin(), s.end() );
The number 400, in theory, should be represented in hex format “01:90”, but in fact it is sent to the UART for some reason;
[D][uart_debug:114]: >>> 31:39:30
Tell me, please, where is the problem?