Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Must read data from serial before writing #1189

Open
ajs256 opened this issue Sep 6, 2020 · 0 comments
Open

Must read data from serial before writing #1189

ajs256 opened this issue Sep 6, 2020 · 0 comments

Comments

@ajs256
Copy link
Contributor

ajs256 commented Sep 6, 2020

Describe the bug
You must read data from serial before writing again. I am using a Parallax Serial LCD, which doesn't send data, if this is a device-specific problem.

To Reproduce
Import this code.

serial.redirect(pins.TX, pins.RX, BaudRate.BaudRate2400)
let buf = pins.createBuffer(2)
buf.setNumber(NumberFormat.Int8LE, 0, 0x11) // Backlight on
buf.setNumber(NumberFormat.Int8LE, 1, 0x0c) // Form feed
serial.writeBuffer(buf)

loops.pause(5) // The display requires this after a form feed

serial.writeString("Test") 
// Display shows "Te"
// serial.readString() // Workaround (uncomment this line)
// serial.writeString("Test") // Workaround (uncomment this line)
// Display shows "Test", not "TestTest"

Expected behavior
I expected the display to show "Test" and not have to run the last two lines.

Desktop (please complete the following information):

  • OS: macOS 10.15.6
  • Browser: Chrome
  • Version: 85

Note: I'm sorry if this belongs in microsoft/pxt - let me know and I'll make it there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant