Blinkled - Help

capper:
I have managed to work on 5 led with more mobile friendly toggle switch

Impressive piece of work. Any chance for letting us have a glance at the code???

I am stuck at password protection. The pc works fine but android and blackberry fail even if password is right using Javascript in the section after other js load.

Solved :slight_smile:

"BLINKLED5"

Password Page

"BLINKLED5"

Note that password field is masked,COOL! 8) isn't it ?

"BLINKLED5"

TADA :slight_smile:


FIND THE ATTACHED ZIP FILE FOR THE SOURCE CODE AND IMAGES

THANKS EVERYBODY.

BlinkLed5.zip (57 KB)

hello,
I am testing 'BlinkLed5.pde' code with Arduino 1.0 but I have these errors :

/Applications/Arduino 1.app/Contents/Resources/Java/libraries/TinyWebServer/TinyWebServer.cpp:36:16: error: SD.h: No such file or directory
/Applications/Arduino 1.app/Contents/Resources/Java/libraries/TinyWebServer/TinyWebServer.cpp: In member function 'void TinyWebServer::send_file(SdFile&)':
/Applications/Arduino 1.app/Contents/Resources/Java/libraries/TinyWebServer/TinyWebServer.cpp:489: error: invalid use of incomplete type 'struct SdFile'
/Applications/Arduino 1.app/Contents/Resources/Java/libraries/TinyWebServer/TinyWebServer.h:15: error: forward declaration of 'struct SdFile'

can you help me?...
thank you.

perchè questo chè è pubblicato qui non funziona sulla 1.0 va modificato

......non sai come và modificato, cosa bisogna cambiare?.... ma sulla 0023 funziona?

BlinkLED5 for Arduino IDF 1.01 attached Below

You need to login to see the file attached Below

BlinkLed5_new.zip (64.3 KB)

capper:
BlinkLED5 for Arduino IDF 1.01 attached Below

You need to login to see the file attached Below

chi ha modificato lo sketch e il file js originali per 5 porte non ha capito nulla di questa libreria :fearful:
Non serve quintuplicare il programma per farlo funzionare, basta inviare un numero corrispondente alla porta da commutare

the original program is good for 5 port or 5000, need only modify string to send server.
this not need

boolean file_handler(TinyWebServer& web_server);
boolean blink_led_handler(TinyWebServer& web_server);
boolean blink_led2_handler(TinyWebServer& web_server);
boolean blink_led3_handler(TinyWebServer& web_server);
boolean blink_led4_handler(TinyWebServer& web_server);
boolean blink_led5_handler(TinyWebServer& web_server);
boolean led_status_handler(TinyWebServer& web_server);
boolean led2_status_handler(TinyWebServer& web_server);
boolean led3_status_handler(TinyWebServer& web_server);
boolean led4_status_handler(TinyWebServer& web_server);
boolean led5_status_handler(TinyWebServer& web_server);
boolean index_handler(TinyWebServer& web_server);

TinyWebServer::PathHandler handlers[] = {
  // Work around Arduino's IDE preprocessor bug in handling /* inside
  // strings.
  //
  // `put_handler' is defined in TinyWebServer
  {"/", TinyWebServer::GET, &index_handler },
  {"/upload/" "*", TinyWebServer::PUT, &TinyWebPutHandler::put_handler },
  {"/blinkled5", TinyWebServer::POST, &blink_led5_handler },  
  {"/blinkled4", TinyWebServer::POST, &blink_led4_handler },
  {"/blinkled3", TinyWebServer::POST, &blink_led3_handler },
  {"/blinkled2", TinyWebServer::POST, &blink_led2_handler },
  {"/blinkled", TinyWebServer::POST, &blink_led_handler },
  {"/ledstatus5" "*", TinyWebServer::GET, &led5_status_handler },
  {"/ledstatus4" "*", TinyWebServer::GET, &led4_status_handler },
  {"/ledstatus3" "*", TinyWebServer::GET, &led3_status_handler },
  {"/ledstatus2" "*", TinyWebServer::GET, &led2_status_handler },
  {"/ledstatus" "*", TinyWebServer::GET, &led_status_handler },
  {"/" "*", TinyWebServer::GET, &file_handler },
  {NULL},

and this not need

function ledStatus2(btn, url) { .........
...
function ledStatus3(btn, url){ .........
...
function ledStatus4(btn, url){ .........
...
function ledStatus5(btn, url) { .........
...
{

this not need

var lightBulb2 = new Button($("#lightbulb2"));
   var lightBulb3 = new Button($("#lightbulb3"));
   var lightBulb4 = new Button($("#lightbulb4"));
   var lightBulb5 = new Button($("#lightbulb5"));
  
   ledStatus2(lightBulb2, "/ledstatus2");
   ledStatus3(lightBulb3, "/ledstatus3");
   ledStatus4(lightBulb4, "/ledstatus4");
   ledStatus5(lightBulb5, "/ledstatus5");

thanks Pablos for pointing out. My objective was accomplished by adding five times the code. but i am a SUPERBAD coder :slight_smile:

Can you upload /attache the corrected code for me to study?

Thanks again for you comment, I am learning arduino and Italiano everyday because of good people like you

Hey,
Thanks for these amazing work.

Im not really be a good programer.
Could you tell me wich part of code i need to change to write my own pasword?
I can see just the password site but i can not see anymore...
Thanks

Thanks for these
very help full for me
but i have problem with parse for this script on index.htm
if(passcode==8488480)
{window.location=password+".htm"}
i can,t redirect to 8488480.htm, and on my scr url like=http://192.168.11.10/?password2=8488480
how to parses this(pasword2)

Hi there.
Did someone solve the problem with the password?

Thanks.

Hi All,

Could anyone help me what is the simplest html code (without additional java file)what can change the state of the leds?
I want to prepare a home control html page, but I can not control the server and I am not an expert in java. Only a button needed for me which sends information to the server and change the state of the led or variable.

Or the other thing is how can I read and process the messages from the client: e.g. href inside HTML: 192.168.1.123/?roloup ad I want to read the client some similar code but it is not working in the loop:

Client& client = web_server.get_client();
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') {
*/

Many thanks
Nolan

I want to prepare a home control html page, but I can not control the server and I am not an expert in java.

You need to learn about html. Java wouldn't help at all.

This place:

is a great resource.

A form has an action tag that defines what script to call when a submit button on the form is pressed. The parameters of the resulting GET request change to reflect the name and value of the button that was pressed.

Have the Arduino serve up a page with a form. Have the form contain submit buttons. Look at what gets sent to the Arduino when the various submit buttons get pressed. It's then simple to collect the incoming data in an array, to know when the array is complete, and to parse and act on the data in the array.

Jumping in and trying to do everything at once is not the way to complete this project. One step at a time is.

If your form is sending a command to the Arduino that changes something, it really should be using an HTTP POST not an HTTP GET.

If your form is sending a command to the Arduino that changes something, it really should be using an HTTP POST not an HTTP GET.

I don't want to start an argument. But, I'm curious about why you say this.

Particularly, since it is the browser on the client end that is making the GET/POST decision, not the user.

Thanks,

But i hoped somebody can send the form and it's content :slight_smile: As I examined with wireshark it is a post method.

Regards,
Nolan

Rather new to Arduino, using the UNO r3 , Ethernet shield & 8meg SD

When compiling the latest ver. of BlinkLed5-new received the following errors:

TinyWebServer\TinyWebServer.cpp.o: In function __static_initialization_and_destruction_0': C:\ARDUINO\libraries\TinyWebServer/TinyWebServer.cpp:43: undefined reference to _FLASH_STRING::_FLASH_STRING(char const*)'
C:\ARDUINO\libraries\TinyWebServer/TinyWebServer.cpp:327: undefined reference to _FLASH_STRING::_FLASH_STRING(char const*)' TinyWebServer\TinyWebServer.cpp.o: In function operator<<':
C:\ARDUINO\libraries\pins_arduino/Flash.h:219: undefined reference to _FLASH_STRING::print(Print&) const' C:\ARDUINO\libraries\pins_arduino/Flash.h:219: undefined reference to _FLASH_STRING::print(Print&) const'

I'm using the latest lib's and Flash 4 .. Any pointers in the right direction to look would be greatly appreciated ..

Thanks
reh