Pages: [1]   Go Down
Author Topic: How to turn on 8 leds through http server of arduino?  (Read 345 times)
0 Members and 2 Guests are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, my first post in international forum smiley

Well, due to a mini project I have in mind, I decided to modify a code that I found on a website by chance. The original post is this

http://geekytheory.com/arduino-ethernet-shield-relay/

It is a LED light with a relay through the browser, but I need to turn all the pins from 2 to 9.

I modified the code but does not work (IDE recognizes flawlessly but when run, screen out a few lines of html code)...

I've uploaded the text..

http://tny.cz/7660216b

A few days doing tests and no way ....... My project is to control anything we have at home by phone, laptop or whatever that is out from arduino network, making a web page /web server if necessary...

To do this I create a room with alarms and fire access, shower, lights, blinds and air conditioning, to see how it looks ...

Another thing that I have in mind is to put a password on that page access (I have something prepared but does not work ...).

Appreciate any help........

Thanks and regards smiley
Logged

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

Somebody ?
 smiley-surprise
Logged

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 26
Posts: 1148
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I am Somebody smiley-wink

What Arduino are you using?

A frequent "beginner" problem is running out of RAM, due to a program being too verbose, using to many text constants, using the String packaage needlessly or a library which need a large chunck of the RAM. I think you've managed all of these. Another typical mistake is to think that the compilers last message "used 8.764 bytes of 30.024 avaialble" has anything to do with RAM.

Suggestion 1: comment out all varaibles and code used for pins 2-7, so the program now only handles 8 and 9. If that works, uncomment so you have pins 7, 8 and 9. And so on, and notice if the program "breaks" when going above.

Rhetorical Question: What are you doing with variable "state8"? You assign one of two character string - effectivly you are signalling a two value logic yet you are using a String type variable. Use a single byte. In your webresponse code use a
Code:
if ( state8 == true ) cliente.print("ENCENDIDO") ; else cliente.print("APAGADO");
That will save heaps of memory.
(Edit: Note:Yes the "==true" is reduntant, but the compiler knows that, and it explains the code clearer for this particular learning experience)

Actually I do not know why your program failed - or what the failure is (you have not explained what you expected the output to be and what it actually produced ... although I can make a pretty good guess, I would rather read your version - I may have guessed wrong). I have simply assumed you have run out of RAM.
« Last Edit: April 19, 2014, 03:55:00 pm by Msquare » Logged

Pages: [1]   Go Up
Jump to: