How to turn on 8 leds through http server of arduino?

Hi, my first post in international forum :slight_smile:

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

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..

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 :slight_smile:

Somebody ?
:open_mouth:

Hello, I am Somebody :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
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.

Tx for the response, "somebody" jeje

Hi Msquare, at spanish forum tell me the same...Although the code they are 15000 bytes, if the code is heavy to move, don´t work....Should be make arrays to liberate ram....

After the school, I´m to test a single byte. In the webresponse, to see if it works....

Tx :slight_smile:

Regards :slight_smile: (I tell you something...)