pxt-calliope/docs/reference/serial/on-data-received.md
Sam El-Husseini e3975e65e5 pxt-microbit Accessibility PR ()
* Accessibility changes
2017-09-07 13:42:08 -07:00

595 B

Serial On Data Received

Registers an event to be fired when one of the delimiter is matched.

serial.onDataReceived(",", () => {})

Parameters

  • delimiters is a string containing any of the character to match

Example

Read values separated by ,:

serial.onDataReceived(serial.delimiters(Delimiters.Comma), () => {
    basic.showString(serial.readUntil(serial.delimiters(Delimiters.Comma)))
})

See also

serial, serial write line, serial write value