Hello, I have an ongoing project that I have been working on for the last few weeks. I now have a programming question since I am not getting the expected behavior from the system.
I created several links on a webpage using the Arduino Mega, Official Wifi Shield and Motor Shield. These links drive a 2 meter LED Strip and a 12V 200x BiPolar Stepper Motor.
I have a series of "if" statements and concluding the logic with an "else" statement as follows:
if (currentLine.endsWith("GET /H") == 1 || currentLine.endsWith("Get /H") == 1) {
scanner(127,127,127, 10); // Violet //Dull White
}
if (currentLine.endsWith("GET /LS") == 1 || currentLine.endsWith("Get /LS") == 1){
leftScanner(255, 0, 255, 10);
}
if (currentLine.endsWith("GET /L") == 1 ||02 currentLine.endsWith("Get /L") == 1) {
colorFollow(strip.Color(127,0,127), 10); //Violet
strip.show();
}
if (currentLine.endsWith("GET /B")==1 || currentLine.endsWith("Get /B") == 1){
blindsForward();
delay(500);
stepperRelease();
}
if (currentLine.endsWith("GET /K")==1 || currentLine.endsWith("Get /K") == 1){
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
blindsBackward();
delay(500);
stepperRelease();
}
if (currentLine.endsWith("GET /O") == 1 || currentLine.endsWith("Get /O") == 1) {
colorFollow(strip.Color(0,0,0), 10); //Off
strip.show();
}
else {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
When I initially click the link to start the "swipe()" function (or any other function) I would get the action as expected. I usually obtain the expected results for an extended period of time so I am sure the code is correct.
However there are instances when I click lets say
client.print("<FONT size = +7><a href=\"/H\"> Scanner</a></FONT>
");
and get the expected results, but when I click a link to another function lets say:
client.print("<FONT size = +7><a href=\"/L\"> Swipe </a></FONT>
");
I will still get the action from the scanner() function, even though I see in my browser a url that ends in "/L"
I am not sure why this happens intermittently. At first I thought it was a power issue, but I ran the set up through the forums here to double check on what I did. I then thought it was a memory issue, but I have no way of testing it that I know of.
Any advice?
For those interested my entire code is attached below.
WifiWebLight_Stepper.ino (12.5 KB)