Doozy! Wrote code in java mode, want to use it on arduino webserver

edited October 2013 in JavaScript Mode

Ok, so I realize this is a DOOZY. I have very little idea what I'm doing so please bear with me.

My project so far is this, and it works great: Wrote a sketch for Arduino that listens for commands over serial. Processing sketch draws a window, and the mouse position is converted and sent to Arduino which then moves servos.

What I want to do is exactly that but over ethernet and from a web page.

I have been able to get Arduino to intialize a web server and I can connect to it over the network, but I need help implementing the graphics sketch into my Arduino sketch.

Here is the Arduino sketch for SERIAL communications:

http://pastebin.com/zC9ZwLy2

Here is the Proccessing sketch which I want to make into a webpage served from the arduino sketch:

http://pastebin.com/mSNgb9k0

I just tried switching to JS mode and clicking run, and it opened a web page with a grey box and nothing happened. Im sure Im going to have to brush up on my JS (been YEARS) so thats not a problem, I'm just hoping someone can point me in the right direction.

This is a sketch that sets up a web server and then does exactly what the serial sketch does: listens for commands. http://pastebin.com/xQJHqqT9

Right now, all it does is make a page that says "Test page" and then listens for client commands.

Thanks in advance!

Comments

  • Here is the Proccessing sketch which I want to make into a webpage served from the arduino sketch:

    http://pastebin.com/mSNgb9k0

    I just tried switching to JS mode and clicking run, and it opened a web page with a grey box and nothing happened.

    You can't use any of the Java libraries with ProcessingJS. In other words: No import statements in your Processing code.

    Since questions such as these always come up again (problems with libraries and problems with variable naming), I think it is high time for a technical FAQ.

Sign In or Register to comment.