Go Down

Topic: Re: Aquarium Controller  with Ethernet (Read 1 time) previous topic - next topic

PaulS

Why is this code in loop?
Code: [Select]
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1,3};

Server server(80);

During every execution of loop, you want to create a new server?

You would be doing yourself, and us, a huge favor if you were to learn to create functions.

Each case in loop should call a separate function.

Some indentation would be useful, too.

Code: [Select]
for (;;){
key = lcd.keypad();
if(key == -1){break;}
}

Magic numbers with no comments are to be avoided. What does the -1 from lcd.keypad() mean?

More code that does not belong in loop:
Code: [Select]
//******************************Web Server******************************
{
 Ethernet.begin(mac, ip);
 server.begin();

 Client client = server.available();
 if (client) {

You are restarting the server on every pass through loop. It's no wonder an external system can not connect to it.

zoomkat

Sorry the origional post got deleted. There are actually people that can try to help.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

kiwikid_1


kiwikid_1

With no thanks to a member's helpful post
Today I went back to the drawing board and after 9 straight hours have something to show for it



I even have managed to get the web page to refresh every 20 sec

zoomkat

Quote
I even have managed to get the web page to refresh every 20 sec


I've seen meta refresh and possibly javascripts do that type of thing.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

kiwikid_1

#5
Dec 27, 2010, 04:40 am Last Edit: Dec 27, 2010, 04:41 am by kiwikid_1 Reason: 1
I used meta......"client.print("<META HTTP-EQUIV=REFRESH content=20 url='http://192.168.1.9' >");"


Not too bad for a Plumber  :-/

retrolefty

Don't you need a counter to show the number of present 'floaters'.  ;)

kiwikid_1

don't know what you just said....but as you see it is how I entered it to the code

Code: [Select]
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.print("<META HTTP-EQUIV=REFRESH content=20 url='http://192.168.1.9' >");
client.println("<body style=background-color:yellow>");
client.println("<font color='red'><h1>ReefController parameters</h1></font>");
client.println("<hr/>");
client.println("<hr/>");

retrolefty

Sorry poor joke I guess. Floaters are what I/we call fish that die and tend to float on the top surface of the water.

Lefty


kiwikid_1

I lost 2K's worth of fish 18 months ago......with MV and it wasn't a joke.

This controller will be looking after my new setup....it's 7 1/2 foot (2mtrs) x 3.3ft (1mtr)

Still got some work to do on the server as you can see....then I want to try and upload it to my website as well....(I know a big ask for a plumber)

Go Up