uart.write( )

classic Classic list List threaded Threaded
3 messages Options
Téo Benjamin Téo Benjamin
Reply | Threaded
Open this post in threaded view
|

uart.write( )

Hello,
I would like to report a bug in uart.write( ... ) function.
When you call it like uart.write( 1, "eLua" ), using a string without any numbers, it works fine.
But when I'm trying to send a number, something goes wrong. The same problem occours if I try to use it like uarte.write( 1, "15" ).

Any idea?!

Thanks,
Teo

_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: uart.write( )

Thanks for signaling this, the problem was fixed on trunk. Note, however,  that there is a difference between

uart.write( 1, "15" )

that acually writes 15 to the screen, and

uart.write( 1, 15 )

that writes the _character with the ASCII code 15_ on the screen (and it's not even meant for sending data to a screen, but for sending raw binary data; consequently, you can't use this function for sending a number larger than 255 to the UART). And, since the character with code 15 is not printable, you won't actually see anything on the screen.The documentation doesn't mention this properly, I'll fix this too. If you want to see the decimal representation of a number on the screen, simply use print, or even uart.write like this:

uart.write( 1, tostring( 15 ) )

Best,
Bogdan

On Wed, Nov 4, 2009 at 5:43 PM, Téo Benjamin <[hidden email]> wrote:
Hello,
I would like to report a bug in uart.write( ... ) function.
When you call it like uart.write( 1, "eLua" ), using a string without any numbers, it works fine.
But when I'm trying to send a number, something goes wrong. The same problem occours if I try to use it like uarte.write( 1, "15" ).

Any idea?!

Thanks,
Teo

_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Téo Benjamin Téo Benjamin
Reply | Threaded
Open this post in threaded view
|

Re: uart.write( )

I'm actually not using this to print. However, when I was testing my program here, using it to print for debugging, I couldn't see the number even using what you've said: uart.write( 1, tostring( 15 ) ) or uart.write( 1, "15" )

Thank you!
Teo

On Wed, Nov 4, 2009 at 4:51 PM, Bogdan Marinescu <[hidden email]> wrote:
Thanks for signaling this, the problem was fixed on trunk. Note, however,  that there is a difference between

uart.write( 1, "15" )

that acually writes 15 to the screen, and

uart.write( 1, 15 )

that writes the _character with the ASCII code 15_ on the screen (and it's not even meant for sending data to a screen, but for sending raw binary data; consequently, you can't use this function for sending a number larger than 255 to the UART). And, since the character with code 15 is not printable, you won't actually see anything on the screen.The documentation doesn't mention this properly, I'll fix this too. If you want to see the decimal representation of a number on the screen, simply use print, or even uart.write like this:

uart.write( 1, tostring( 15 ) )

Best,
Bogdan

On Wed, Nov 4, 2009 at 5:43 PM, Téo Benjamin <[hidden email]> wrote:
Hello,
I would like to report a bug in uart.write( ... ) function.
When you call it like uart.write( 1, "eLua" ), using a string without any numbers, it works fine.
But when I'm trying to send a number, something goes wrong. The same problem occours if I try to use it like uarte.write( 1, "15" ).

Any idea?!

Thanks,
Teo

_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev