#SerialPort - Arduino School Project

15 messages · Page 1 of 1 (latest)

severe spear

Going for some cheeky extra credit and trying to control the arduino ports 3-10 using nodeJS and I have that working just fine HOWEVER I can only have 1 serial connection open at once so what I wanted to know what how can I construct and define the serial connection in a single file and use that in my command files ect?

I will send some screenshots so it makes more sense

lucid pastureBOT
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
severe spear

This is one command file

And the other command file

Now that both can't have an active connection and I want to keep the connection open at all times rather than opening and closing

So can I construct it in another file and use it like a module export?

misty tide

Define port and parser in a single file and export them from there, import them in your commands

Yes

severe spear

Okay I will give that a go

I tried earlier but completly messed it up

tried putting in a module export then importing it in the other scripts

misty tide

That sounds correct though Thonk

severe spear

I would have done it wrong lol I am a bozo at this still

Learning slowly but surely

severe spear