i got some develpments...
i found this code in this forum (i changed a bit)
//zoomkat 12-08-11, combined client and server
//simple button GET with iframe code
//for use with IDE 1.0
//open serial monitor and send an g to test client and
//see what the arduino client/server receives
//web page buttons make pin 4 high/low
//use the \ slash to escape the " in the html
//address will look like http://192.168.1.102:84 when submited
//for use with W5100 based ethernet shields
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
IPAddress ip(192,168,10,70); // ip in lan
IPAddress gateway(192,168,10,1); // internet access via router
IPAddress subnet(255,255,255,0); //subnet mask
IPAddress myserver(192,168,10,50); // zoomkat web page
EthernetServer server(6969); //server port
EthernetClient client;
String readString;
//////////////////////
void setup(){
pinMode(13, OUTPUT); //pin selected to control
Ethernet.begin(mac, ip, subnet, gateway);
server.begin();
Serial.begin(9600);
}
void loop(){
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
//Serial.print(c);
}
//if HTTP request has ended
if (c == '\n') {
///////////////
//now output HTML data header
if(readString.indexOf('?') >=0) { //don't send new page
client.println("HTTP/1.1 204 Zoomkat");
}
//stopping client
client.stop();
///////////////////// control arduino pin
if(readString.indexOf("on") >0)//checks for on
{
digitalWrite(13, HIGH); // set pin 4 high
}
if(readString.indexOf("off") >0)//checks for off
{
digitalWrite(13, LOW); // set pin 4 low
}
//clearing string for next read
readString="";
}
}
}
}
}
//////////////////////////
i allows me to turn the pin high/low as i wanted, but i still miss 2 things...
on my javascript:
var luzcoz1=1;
function lcoz1() {
var floatimg = document.getElementById("lcoz1");
if ( luzcoz1== 1){
floatimg.src="../images/luz_on.png"
luzcoz1=0;
} else {
floatimg.src="../images/luz_off.png"
luzcoz1=1;
}
}
<a href="http://192.168.10.70:6969/?off"><input alt="" src="images/luz_off.png" onclick="lcoz1();" id="lcoz1" style="float: right; width: 50px; height: 50px; " type="image" /></a>
i have to create 2 image buttons, one for each href, is there a way that i can use the same javascript function to change the URL as well?
and after that, im only gonna need to get the status from arduino pins and show the images depending of those values...
i hope i made myself clear cause my english os not that good
Thanks in advance