-->
Page 1 of 2

print chr(0) error

PostPosted: Thu Aug 18, 2016 8:47 pm
by rey
print chr(0) is not working in ESP Basic 3.0.Alpha 41

' NOT WORKING
for i=0 to 255
print i & " - " & chr(i)
next i
end

and

'WORKING
for i=1 to 255
print i & " - " & chr(i)
next i
end

I think that I have the similar problem with SERIAL2INPUT command.

Re: print chr(0) error

PostPosted: Sat Aug 20, 2016 6:53 am
by Electroguard
Nice catch rey.
It why sending absolute file chr(0) to JQ6500 voice module using serial2 does not work, even though file 0 can be accessed relatively (next or previous).

Re: print chr(0) error

PostPosted: Sat Aug 20, 2016 7:34 pm
by Mmiscool
The problem with chr(0) is that it terminates a string c/c++.

If you notice it prints out on the serial port but the web output is cut off at this point.

I suggest never using print or wprint to output this character.

You may still use serialprint to send this character out the serial port.

Re: print chr(0) error

PostPosted: Sun Aug 21, 2016 6:46 pm
by rey
Thank you very much for your response and excellent work.

I have a problem. I work with modules that use hex commands and need to send and receive chr (0) by the serial port.
Sending chr (0) is OK, but receiving the hex command truncates the message when chr (0) is received.