On Mon, Nov 17, 2014 at 12:03 PM, John Mladenik <[email protected]> wrote:
> I watched and went through 3 tutorials for setting up a web server to
> control BBB GPIO and even went through the Simon Monk book and downloaded
> this simple IO example
>
>
>
> Here are 3 of the examples I have tried:
>
>
>
> Beaglebone and Websockets, a full example that turn on/off a led
>
> http://isolasoftware.it/2012/04/23/beaglebone-and-websockets-a-full-example-that-turn-onoff-a-led/
>
> BoneScript SocketIO Example
>
> https://github.com/lgxlogic/BoneScript-SocketIO
>
>
>
> From the Simon Monk book use 09_01_led_control.html and
> 09_01_led_control_server.js
>
> https://github.com/simonmonk/prog_bbb/find/master
>
>
>
>
>
>
>
> None of these examples work on my BBB.   I can control hardware/GPIO using
> Javascript through Cloud9 or python running directly on the BBB but cannot
> get it to change an IO through an HTML web app as are shown in these
> tutorials.   And the only way javascript actually ran until I turned off the
> debugger was to drag and drop it into the autorun folder otherwise they will
> not run with the debugger on through the cloud9 interface.
>
>
>
>  When I served up the jQuery/Flot examples on the BBB through a browser at
> least they seem to work I do not have a bacon cape I have my own custom
> cape.  For now I would like to control only 3 GPIO on the beaglebone through
> a web page.  So far I can only do it through directly running Py or JS.    I
> do get this error,  I will eventually need to read/write the UART but I will
> worry about that once I get the simple GPIO working.
>
>
>
> </html><script src="/static/preview/livecss.js"></script>
>
> Failed to load resource: the server responded with a status of 404 (Not
> found)
>
>
>
> Which is weird since the "livecss.js" line is not even in the HTML as far as
> I can see
>
>
>
>
>
> I did install socket IO and had to change the src line to this(Specific
> directory link) in order to get it to NOT give an error. Errors are using
> Chrome debugger.   (CTRL-SFT-J)
>
>
>
>   <script
> src="http://192.168.7.2:3000/preview/node_modules/socket.io/node_modules/socket.io-client/socket.io.js";>
> </script>
>
>
>
>
>
> the first error happens right after the line
>
>
>
> var socket = io.connect();
>
>
>
> Uncaught ReferenceError: io is not defined.
>
>
>
>
>
> Then I get an error whenever a button is pushed which is
>
> Uncaught TypeError: Cannot read property 'emit' of undefined
>
>
>
> Any suggestions or recommendations?  I am a hardware engineer trying to
> learn software to develop code to control a Beaglebone based product I
> designed.   I need to develop remote menus that run on PC, Cell Phone,
> tablets etc. and after watching these videos/tutorials it seem like using
> HTML/JS through the server is the way to go.   The other option is to add an
> LCD and develop a Menu through that and do the Server HTML menus later but
> that adds the LCD acquisition/development,/test to the equation right now,
> and I want to put that off until we get the system working.  I have designed
> simulated and tested all of the pieces of hardware with simple Python
> programs but I need to develop an interactive menu based approach so the
> consumer can control the product.
>
>
>
> Any help or suggestion would be greatly appreciated.
>

If you can limit the different things you are trying and focus on
describing the step-by-step you followed from a known starting point,
it would be much easier to respond. You seem to be missing some basic
understanding of how things work.

Looking at Simon's example (without the book in front of me), it seems
clear he's relying on starting up a server on port 8085.

What happens when you execute 'node 09_01_led_control_server.js'? What
is the output from the script?

What happens when you browse to http://192.168.7.2:8085 (or
http://beaglebone.local:8085 if over Ethernet/WiFi)?

All of these examples are interesting and helpful to aide your
understanding, but none take full advantage of what comes pre-setup on
the boards. If you want to keep it simple, at least from my
perspective, you can simply use something like this:
https://gist.github.com/jadonk/f89a0f1f0ddef06777de

I borrowed from Simon's example, but skipped the process of setting up
a new server, since the existing server works fine. I also skipped the
part about defining message senders and handlers, since BoneScript
already has remote procedure call senders and handlers built in.

Save simpleLED.html using the Cloud9 IDE and then browse to
http://192.168.7.2/simpleLED.html. You should be good-to-go. If your
board is at another address, you'll need to change the address in the
URL. The built-in server, socket.io and RPC should do all the hard
work for you.

You can even do this super-quick from JSFiddle:
http://jsfiddle.net/jkridner/16j3rsL9/

If your board is at a different address, again, you'd need to change
the external resource to point to your board.

Hope this helps. If it does, please consider writing it up in a way
that you understand and putting it out there for others. It all seems
simple to me, but that's because I already know it. Getting it
explained from the point of view of someone just starting is critical.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to