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

Example with AT commands? #3

Open
brandonros opened this issue Feb 24, 2020 · 1 comment
Open

Example with AT commands? #3

brandonros opened this issue Feb 24, 2020 · 1 comment

Comments

@brandonros
Copy link

const device = new UsbSerial({
  baud: 115200
})
device.on('data', (data) => {
  console.log(data)
})
device.on('ready', () => {
  console.log('atz')
  device.send(Buffer.from('>ATZ\n'))
  setTimeout(() => {
    console.log('ati')
    device.send(Buffer.from('>ATI\n'))
  }, 5000)
})
$ node index.js 
atz
<Buffer 3e>
<Buffer 3f>
ati
<Buffer 3e>
<Buffer f2>

I would not expect this behavior. What am I doing wrong?

@ironiridis
Copy link

So the first response you're getting is >? so it sounds like the device you're talking to isn't expecting something. Based on the typical Hayes-style pattern for commands, I would expect you to send an ATZ\n at the start of the line. Of course, that depends entirely on the device you're communicating with at the other end of your USB-to-Serial device.

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

2 participants