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

a reconnect feature ? #1546

Closed
koraysels opened this issue Jan 7, 2019 · 6 comments
Closed

a reconnect feature ? #1546

koraysels opened this issue Jan 7, 2019 · 6 comments
Assignees

Comments

@koraysels
Copy link

koraysels commented Jan 7, 2019

how can I look for a new board after my current board connection is lost ? I know I have to re-initialize everything and also the state but that is no problem. I just want tobe sure that if no board is found or a board has disconnected, that the prgram keeps looking for new avaliable board and connect to it.

I have not found any possible way to do this yet... is it even possible ?

@divanvisagie divanvisagie self-assigned this Feb 26, 2019
@divanvisagie
Copy link
Collaborator

From a 1000 foot view I'm thinking that you may be able to solve this with a package called usb-detection

Currently trying to get a POC working, I can get the board to init after running the app and then plugging it in, however I can't get the board to connect a second time after unplugging it.

Will keep you posted.

@dtex
Copy link
Collaborator

dtex commented Mar 3, 2019

@koraysels Just to be sure, you are using an Arduino connected over USB correct?

@dtex dtex added the question label Mar 3, 2019
@koraysels
Copy link
Author

koraysels commented Mar 4, 2019

correct! A USB Arduino Uno

@divanvisagie
Copy link
Collaborator

Right, so I have set up an example program here: https://github.com/divanvisagie/j5-restart/blob/master/index.js

With regards to:

Currently trying to get a POC working, I can get the board to init after running the app and then plugging it in, however I can't get the board to connect a second time after unplugging it.

I found that when the board is disconnected, it wasn't removed from the Serial.used list so the next time you connected the board it was seen as already in the list.

I made a change here to remove the board when disconnected, however we seem to be holding onto other things as well.

When I plug the board back in there are no longer errors and the board does seem to connect again, but the LED no longer flashes.

If we make use of the blink callback we can see that blink is called even after the board is disconnected. This feels to me like we need to do some other cleanup as well but I have no idea where to start in terms of this.

@LiorBird
Copy link

@divanvisagie @koraysels thanks for all of your input but I was curious if you ever managed to fix that problem? I'm trying to use an Arduino Due using the Johnny-Five script function and I encounter the same problem... Sorry for bringing up this issue again, but I couldn't find an answer anywhere else. Thank you so much!

@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Jul 21, 2021
@stale stale bot closed this as completed Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants