Problem connecting to Puck.js from the web IDE after using DroidScript

342 views
Skip to first unread message

dklinkman

unread,
May 24, 2017, 3:23:26 PM5/24/17
to DroidScript
Everything seems to work fine between DroidScript and the Puck and I can run multiple example programs.  The issue I see is after running one or more examples, is that when I try to connect to the Puck from the web IDE, I can connect just fine but I can't interact with the Puck.  I can receive data from the Puck, like if I press the button I get something like BTN:1, BTN:0, but my keystrokes to the Puck are not recognized.  I've tried using app.reset() in DroidScript, and I've also sent reset() as code.  The reset works but I still have the issue.  The only way I can clear the issue is to remove the battery from the Puck.  Note that even though I am having this issue with the web IDE, I can still run additional Puck examples from DroidScript.  So what I'm curious about is DroidScript possibly leaving the Puck in a state where the web IDE can't interact with the Puck after DroidScript disconnects?  The Puck is running the most recent v92 firmware.  The phone is a Galaxy S6.  The standalone web IDE runs on Win7.  Tested and verified using more than one Puck.

Thanks!!   --D

Dave Smart

unread,
May 25, 2017, 6:07:20 AM5/25/17
to DroidScript
What do you mean by "my keystrokes to the Puck are not recognized"?  

How exactly are you sending keystrokes?

dklinkman

unread,
May 25, 2017, 7:50:37 PM5/25/17
to DroidScript
Sorry for being unclear.  The Espruino Web IDE connects to the Puck.js over Bluetooth.  The left side window of the IDE is essentially a terminal within which you can interact with the Puck directly, enter commands, type and run a short program, read output from a program running in the Puck, etc.  After resetting the Puck by removing the battery I can connect to it using the web IDE and interact with it successfully using the left side window.  For example, if I type reset() on the keyboard, the Puck will reset and display its firmware version number and return to a prompt.  If I type dump(), its program and global state will be displayed, etc.  So this is all normal.

What I have observed is that after I have connected to the Puck by running one or more Puck examples within DroidScript, when I subsequently connect to the Puck using the web IDE I can connect just fine, but as I type in the left side window the Puck is no longer accepting and/or responding to keyboard input.  But as I mentioned the left side window does appear to be outputting text from the Puck because if I press the button, BTN:1 and BTN:0 are displayed.  I assume this is because of the program that was sent from DroidScript to the Puck.  If I disconnect the web IDE I can again run DroidScript programs using the Puck and everything continues to work fine.  But if I again connect the web IDE, the Puck does not accept and/or respond to keyboard input.  This pattern continues until I power cycle the Puck by removing the battery.

My thought, and the reason for my inquiry, is maybe the program that is sent from DroidScript to the Puck to enable its interaction might still be running, or perhaps left the Puck in a state that affects subsequent access from the web IDE until it is reset by removing the battery.  I did try a soft reset by using DroidScript to send a reset() command, and I also tried app.reset() but that didn't work.  I confirmed the reset worked (turned on an led, waited 1 second, reset(), led goes out) but the problem with the web IDE remained.

I hope this is clearer.  Thanks!!!   --D

Dave Smart

unread,
May 26, 2017, 6:51:17 AM5/26/17
to DroidScript
OK, I see what you mean now.  You were confusing me by talking about the WebIDE because I thought you were referring the the DroidScript Web/Wifi IDE :)

When you connect via Bluetooth from your phone to the puck you are using the Puck's serial port to communicate.  This same serial port is used when connecting from the Espruino/Puck Web IDE but it won't be available for use if it has already been assigned to the Bluetooth coming from the phone.

Turning the Bluetooth off on your phone might fix it, but I'm not sure.  

I actually have an alpha version of a plugin for the DS Wifi editor that allows you to program the puck by typing into a text window (it communicates through your phone to the puck), you could try that if you like?

Regards
David 

dklinkman

unread,
May 27, 2017, 5:25:58 PM5/27/17
to DroidScript
I confirmed that disabling Bluetooth on the phone doesn't change the situation.  Again I can connect to the puck from the Espruino web IDE but the puck doesn't respond to keyboard input, though it does produce console output.

It's not that big a deal really.  I was trying different things and moving back and forth between the Espruino IDE and DroidScript and noticed this issue.  If power cycling is needed to go back it's not a problem.

I am however, interested in the text window you mentioned.  At least with that I can query variables and run snippets even while the Puck is 'owned' by DroidScript.  That will be great.

Thanks!!  --D
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Dave Smart

unread,
Jun 6, 2017, 2:32:42 PM6/6/17
to DroidScript
Try this WiFi IDE extension, it can connect to Espruinos via USB or Bluetooth through your phone.  (Make sure you have the Puck.js plugin installed)

Extract the 'Espruino' folder into a folder called 'Extensions' under the DroidScript folder on your device and then refresh the Wifi IDE

(You will need to delete the .dat extension after downloading and please bear in mind that this is an alpha version)
DS-Espruino_Extension.zip.dat
Reply all
Reply to author
Forward
0 new messages