Available on: coco

SERIAL READ

This command allows you to read one or more bytes, up to a whole string, from the serial port. The simplest syntax is the one that allows you to retrieve a string from the serial port, indicating the number of characters (chars) to read. It is possible to omit the size (in bytes) to read and instead directly indicate the type. In this case, a piece of data will be read from the serial port as long as the indicated type. In this last use case, the programmer must pay particular attention to the order of the bytes, where the data exceeds the size of one byte. In other words, the data is read with the endianess prevailing on the target computer. To change this behavior and ensure that the endianess is the same, regardless of the computer used, it is necessary to use the BIG ENDIAN or LITTLE ENDIAN option, to indicate the preferred endianess.

SYNTAX

 = SERIAL READ [()] AS datatype [BIG ENDIAN|LITTLE ENDIAN]
 = SERIAL READ (chars)


Legend
  • id : identifier
  • type : datatype
  • v : value
  • "..." : string
  • [...] : optional

EXAMPLE

 result = SERIAL READ AS BYTE


ABBREVIATION: SErR#

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:

  • PUR-120 - A game in 10 lines of max 120 characters (w/abbrev.)
  • EXTREME-256 - A game in 10 lines of max 256 characters (w/abbrev.)
  • SCHAU - Any program in 10 lines of max 256 characters (w/abbrev.)
In order to reduce space you can use this abbreviation for this instruction:

SERIAL READ ↔ SErR#

Any problem?

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