Jump to content

mechanic

Members
  • Content Count

    3
  • Joined

  • Last visited


Reputation Activity

  1. Like
    mechanic got a reaction from Automate in Extending JavaScript Network Usefulness   
    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.
     
×
×
  • Create New...