Pages: [1]   Go Down
Author Topic: Javascript PONG in webserver on Ethernet Shield  (Read 2229 times)
0 Members and 1 Guest are viewing this topic.
Hamme, Belgium
Offline Offline
Sr. Member
****
Karma: 4
Posts: 390
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I just made this sketch to show that you can use JavaScript in your embedded webpage on the Arduino. I didn't use an SD card, or an external link. I've just put the pong game made by Joe Nesbella in an html page and then into to sketch.

It's just a proof of concept.



the sktech is about 10856 bytes and doesn't use much of SDRAM thanks to avr/pgmspace.h (a buffer of 110 bytes)

So now you know you can all make fancy webpages for your pin toggling web paged Arduinos.

* javascriptpong.pde (10.9 KB - downloaded 46 times.)
Logged


Silly-con Valley, Ca, U.S.
Offline Offline
Sr. Member
****
Karma: 17
Posts: 420
Lernin' to tinker
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you should have no problem with JavaScript because it is run in the browser, not off the server. The server just serves it up like it would HTML. Your only issue is with space.
Logged

10 PRINT CHR$(7)
20 GOTO 10

Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can you share your code please ?
Logged

Hamme, Belgium
Offline Offline
Sr. Member
****
Karma: 4
Posts: 390
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I can. I've already attached the sketch in the first post, so you can download it. Remember that this only is a simple webserver, that feeds you a webpage with pong. It doesn't use the arduino to handle buttons.

Don't forget to change IP

Quote
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1, 117 };

« Last Edit: December 02, 2011, 03:11:35 am by JO3RI » Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good thank you.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It don't work, is it for w5100 or enc28j60 ?
Logged

Hamme, Belgium
Offline Offline
Sr. Member
****
Karma: 4
Posts: 390
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I made this for the Arduino Ethernet shield or Arduino Ethernet with the Wiznet W5100 ethernet chip.
It also was made this for Arduino 0.22, maybe you already have Arduino 1.0?

Are you able to compile the sketch?
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My shield is a cheap version from china, i use the ENC28J60. I can upload without any errors but when i try the webpage it do not work.
Logged

Hamme, Belgium
Offline Offline
Sr. Member
****
Karma: 4
Posts: 390
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I do know that:

#include <SPI.h>
#include <Ethernet.h>

are for the Wiznet W5100 ethernet chip, maybe you need to adapt these to get the right libraries for the ENC28J60

this page might help you:

https://github.com/turicas/Ethernet_ENC28J60/

you'll have to download that library and use it instead of the one included in Arduino.

Logged


Pages: [1]   Go Up
Jump to: