Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Rick Waldron
@rwaldron
@lucas-sg I just ran npx typescript lib/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types and generated a ./types. It will probably need more attention, but I think that get's you somewhere at least, right?
I should know this, considering I write TS exclusively at work 🤦‍♂️
reconbot
@reconbot:matrix.org
[m]
as any one would
Rick Waldron
@rwaldron
lol
Lucas Sanz Gorostiaga
@lucas-sg
I'm sorry Rick, I don't understand what lib/**/*.js is supposed to represent in my Electron (Node) project. I don't have a lib folder, unless it's well hidden in a specific folder under node_modules, and therefore the command won't run.
I'm sure there is something really silly and basic I'm missing from it but I'm kind of a noob in Typescript and Electron as you can see.
reconbot
@reconbot:matrix.org
[m]
Just use (proximity as any).pause() until he fixes the types
Rick Waldron
@rwaldron
@lucas-sg oh, I'm sorry—that wasn't meant to be for you to do anythng with, that was me experimenting with adding generated .d.ts files to johnny-five
Lucas Sanz Gorostiaga
@lucas-sg
@rwaldron sorry to bother you again with this but what does pause() actually do? I'm trying to plot a real-time plot with Plotly and when I use pause() it resets the plot. It does pause the reading but the unwanted effect is that I now need to save the plot data before hitting pause() so that it doesn't disappear, but stays there frozen instead.
Btw thanks @reconbot:matrix.org the as any cast worked fine :)
Rick Waldron
@rwaldron
@/all johnny-five's default branch has been renamed "main".
@lucas-sg I've published v2.1.0 which now has pause() and resume() on everything that's an event emitter!
Rick Waldron
@rwaldron
@lucas-sg All pause() does is copy the contents of the _events property into a weakmap, then set _events = {}
Your handlers won't be called until you resume(), which takes the object out of the weakmap and sets _events = ...
Can you share your code?
EJ2KDJ
@EJ2KDJ
Hi, does anyone know a place to ask a question about CH341? I’ve posted in the Arduino forum, I also went to the Nodebot Community Forum (URL is dead), the npm forum says it’s archived. I’m a beginner and I'm getting an error message that I can’t figure out.
reconbot
@reconbot:matrix.org
[m]
Do you have a link for it?
Donovan Buck
@dtex
@EJ2KDJ It looks like your not using the right command to load and run your js file. I think you're typing node run. You should instead pass the name of your js file like node myfile.js
EJ2KDJ
@EJ2KDJ
@dtex Thx for your reply, I believe I did what you suggested, however now i’m getting a new error and I posted it in the Arduino forum here:
https://forum.arduino.cc/t/ch341ser-error-when-trying-to-run-led/911832
EJ2KDJ
@EJ2KDJ

I’m getting this error when I run my script:

1637373588949 Connected COM4 
1637373588955 Available COM3 
1637373588956 Connected COM3 
1637373592592 Repl Initialized 
>> 1637373598958 Device or Firmware Error A timeout occurred while connecting to the Board.

I’ve checked the troubleshooting instructions on:

https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting

But, I’m still unable to fix it after installing StandardFirmata. FYI- I’m using an Arduino clone (CH341)

Am I on the right track? Any advice would be much appreciated.

Lucas Sanz Gorostiaga
@lucas-sg
Hi, how could I upgrade the SerialPort dependency to use > 10.x.x?
Also sorry for not responding the previous message @rwaldron . I left that part of the project to a colleague, I'll let you know if I have more questions regarding the usage of pause() :)
reconbot
@reconbot:matrix.org
[m]
It would take a release of j5
Lucas Sanz Gorostiaga
@lucas-sg
So there's no way for me to accelerate the process then?
reconbot
@reconbot:matrix.org
[m]
It’s not a difficult upgrade but I’m not sure you could just provide an open port to j5
Lucas Sanz Gorostiaga
@lucas-sg
What do you mean by open?
reconbot
@reconbot:matrix.org
[m]
I think maybe You could make a serialport object and open it and then give it to j5, but since it depends on serialport I’m not sure how the versions interact
Lucas Sanz Gorostiaga
@lucas-sg
I'm not sure I'm following, I'm not using a serialport object in my project, I'm only using the Board, LCD and Proximity objects
reconbot
@reconbot:matrix.org
[m]
J5 uses serialport under the hood, but when you make the board object you can give it a serialport
I’m not sure if it can take a v10 port the api didn’t change much but it did change
If you don’t give it a serialport object it makes one. (It might call it a transport you’d have to check the docs. im cooking dinner)
Lucas Sanz Gorostiaga
@lucas-sg
@reconbot:matrix.org could you maybe guide me a bit with the serialport object? I'm unable to build my project, not sure where the error is coming from. Looks like it's something to do with bindings-cpp.
image.png
        board = new Board({
            repl: false,
            debug: false
        });
That's the old code
And this is the new one:
        board = new Board({
            port: new SerialPort({
                path: "/dev/tty.usbserial-1410",
                baudRate: 115200        
            }),
            repl: false,
            debug: false
        });
Lucas Sanz Gorostiaga
@lucas-sg
I tried with other baud rates such as 9600 and 57600 but it didn't make any difference
Lucas Sanz Gorostiaga
@lucas-sg

Changing the subject to a more J5 focused discussion I'm getting the following error:

1646263818699 Device or Firmware Error A timeout occurred while connecting to the Board. 

Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting

If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again. 

 code: 'ERR_UNHANDLED_ERROR',
class: 'Device or Firmware Error',

when testing my board's connectivity

I did reupload the StandardFirmataPlus firmware through the Arduino IDE
reconbot
@reconbot:matrix.org
[m]
I’d try to see if you get any data from the port without j5
I don’t know what the current default baudRate is
You can probably find it in the j5 source
I think you’re on the right track
Lucas Sanz Gorostiaga
@lucas-sg
Any idea of how I might learn to interpret the data that I read from the serialport I opened? I'm using an Arduino Mega 2560 and want to read the distance from the proximity sensor connected to it. When reading the data of the "data" event I get a buffer object whose data I don't know how to interpret.
Lucas Sanz Gorostiaga
@lucas-sg
@reconbot:matrix.org what I mean is that I managed to instantiate and read from a port but when I use it inside the Board I get the error from the above red screenshot. How should I procede with the J5 PR for the serialport 9.x to 10.x upgrade? @rwaldron
Lucas Sanz Gorostiaga
@lucas-sg
I was trying to see if I could add serialport@10 to j5 so I tried to test the project running simply 'grunt' but 11 tests failed without me even having updated serialport or any other package.
The errors are throwing up in test/board-connection.js:9:5, test/board-connection.js:17:5 and test/board.serial.js:13:18 with the error message TypeError: Cannot stub non-existent own property list. Any idea of what I might be missing?
Lucas Sanz Gorostiaga
@lucas-sg
Hi, does anyone have an idea of how to put the close event of the Board object to use? I've created a Board object, I'm able to communicate with it and I've added a callback function for the .on("close", () => { ... }) event, but I'm not seeing the callback being called after I disconnect from the USB port.