tttapa / Projects

GNU General Public License v3.0
32 stars 22 forks source link

TypeError: SerialPort.list #1

Open jpnielsen opened 2 years ago

jpnielsen commented 2 years ago

Hi,

I found your post on the arduino.cc forum https://forum.arduino.cc/t/osc-over-usb/520680/13 Thank you very much for sharing this.

I plan on connecting a couple of joysticks to VCV Rack using a Raspberry Pi Pico on USB.

It gives this error message, when I run the node scripts.

 node .\main.js 8888 9999 localhost
Server listening on port 8888
(node:15376) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
C:\Users\jpn99\node_modules\@serialport\stream\lib\index.js:651
    throw new TypeError('SerialPort.list no longer takes a callback and only returns a promise')
          ^

TypeError: SerialPort.list no longer takes a callback and only returns a promise
    at Function.SerialPort.list (C:\Users\jpn99\node_modules\@serialport\stream\lib\index.js:651:11)
    at Object.<anonymous> (C:\Users\jpn99\GoogleDrive\vcv-builds\_osc\main.js:105:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47
node -v
v16.13.1
 npm view serialport

serialport@9.2.8 | MIT | deps: 11 | versions: 164
Node.js package to access serial ports. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
https://github.com/serialport/node-serialport#readme

keywords: ccTalk, com port, data logging, hardware, iot, johnny-five, modem, nodebots, RFID, robotics, sensor, serial port, serial, serialport, sms gateway, sms, stream, tty, UART

dist
.tarball: https://registry.npmjs.org/serialport/-/serialport-9.2.8.tgz
.shasum: abf9f59ac50ac3d130f6a10de141765a9d86da73
.integrity: sha512-FsWpMQgSJxi93JgWl5xM1f9/Z8IjRJuaUEoHqLf8FPBLw7gMhInuHOBhI2onQufWIYPGTz3H3oGcu1nCaK1EfA==
.unpackedSize: 8.6 kB

dependencies:
@serialport/binding-mock: 9.2.4              @serialport/parser-delimiter: 9.2.4          @serialport/parser-regex: 9.2.4
@serialport/bindings: 9.2.8                  @serialport/parser-inter-byte-timeout: 9.2.4 @serialport/stream: 9.2.4
@serialport/parser-byte-length: 9.2.4        @serialport/parser-readline: 9.2.4           debug: ^4.3.2
@serialport/parser-cctalk: 9.2.4             @serialport/parser-ready: 9.2.4

maintainers:
- reconbot <wizard@roborooter.com>
- hipsterbrown <headhipster@hipsterbrown.com>

dist-tags:
beta: 10.0.1   latest: 9.2.8

published a month ago by reconbot <wizard@roborooter.com>
jpnielsen commented 2 years ago

Workarounds:

In main.js I commented out the serialport.listsection

and hardcoded the port comName = 'COM3'; // Uncomment this line to select a specific port instead of searching for an Arduino.

to get rid of the Buffer() warning, I changed to 'Buffer.alloc(0);' in slip.js

But I'm not skilled in .js

after this, the .ino runs on Raspberry Pi Pico and the .js bridge sends OSC to Protokol (https://hexler.net/protokol)

To get the arduino code to build, I cloned the repo https://github.com/CNMAT/OSC.git to my schematic dir, and changed

include \<xxxxx>

to

include "xxxxx"

for the CNMAT libraries.

I don't know how to include properly :)