read Line
Read a line of text from the serial port.
serial.readLine()
Returns
- a string containing input from the serial port, such as a response typed by a user
Example
The following example requests the user’s name, then repeats it to greet the user.
basic.forever(() => {
serial.writeLine("What is your name?")
let answer = serial.readLine()
serial.writeString("Hello,")
serial.writeLine(answer)
})