This command allows you to write one or more bytes, up to a whole string,
to the serial port. The simplest syntax is to write a variable to the
serial port: in this case, the command will send the exact number of bytes
needed to the serial port. To ensure that the actual size is respected, it is
possible to indicate the type of data to be considered. Finally, in the case of
data types larger than a byte, it is possible to indicate the endianess with which
the data will be sent to the serial port.
This instruction allows you to write one or more bytes to the standard serial
connection. The instruction will return FALSE
if any error occurs.
= SERIAL WRITE( variable [AS type] ) [BIG ENDIAN|LITTLE ENDIAN] SERIAL WRITE variable [AS type] [BIG ENDIAN|LITTLE ENDIAN] = SERIAL WRITE( data ) = SERIAL WRITE( size )
result = SERIAL WRITE( 42 AS BYTE ) result = SERIAL WRITE( "test" ) result = SERIAL WRITE( 1 )
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
SERIAL WRITE ↔ SErW#
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS