Jump to content
Sign in to follow this  
mechanic

Extending JavaScript Network Usefulness

Recommended Posts

Extending the Beaglebone Black network JavaScript usefulness.

Mozilla, and its sister Iceweasel, have a web developer tool called Scratchpad.
Scratchpad is available under the Tools/Web Developer menu on these browsers.

What Scratchpad will allow is to write Bonescript programs on your main system and then run them on the Beaglebone just as if you modified the examples on the web page that the Beaglebone serves to your network connection. You can also save and edit your programs with Scratchpad.

For example;

Start the Beaglebone and connect to its web page.
Click on the RUN button on top of the example Bonescript.
All four LEDs should lite for 2 seconds.

Now highlight the Bonescript code using the Right mouse button and then copy it using either CTRL+c or the copy function in Mozilla's Edit menu.

Go to the Tools menu on Mozilla and select Web Developer -> Scratchpad.
Then either use CTRL+v or the paste function in Scratchpads Edit menu to copy the code into Scratchpad.

Clicking the RUN button in Scratchpad will now execute the code on the Beaglebone.
NOTE* The Mozilla browser on your computer must be pointing to the Beaglebone in order for this to work. If you have a different tab open and active the server for that tab will not understand what you are doing.

Save the program in Scratchpad somewhere on you computer with a suitable name like usrled.js .

Playtime;

In the Scratchpad window highlight the line "b.digitalWrite('USR3', b.HIGH);" and click RUN. Only one LED should light and stay lit.
Edit the same line and change the "HIGH" to "LOW" and again highlight that line and run it. The LED should go off.

If you now click RUN without selecting a line, only three LEDs should lite for 2 seconds.

Have Fun. :)
 

Share this post


Link to post
Share on other sites

I wonder how useful this would be for a stock Nodejs server on the BBB. I have not really looked too deep into Jasons code but I'd imagine he has some sym links, or binaries that do all the heavy lifting on the backend. Personally, I have no use  for Bonescript, as I'd rather use my own abstraction layer, but I was unaware of of scratchpad ( I'm not really a web dev ), but know javascript "fairly" well.

 

Pretty cool thanks for the info :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...