Moderator: igrr
Please see picture attached. This lists first the values that I entered for the frequency then the 3 duty cycles which are set and work very briefly before the Get request for the favicon is sent and bring's 0's which reset the duty cycle.
Do you have any idea's on a better way to handle the favicon so that it doesn't reset the values?
The if statement that I mentioned in my previous post does not seam to be working correctly as the LED's do not blink to the frequency and duty cycle that I try to set.
I wanted to have it look for the the arguments but had problems on how to do it. Below is how I tried in my origional code.
if (req.indexOf("/?freqVal1") != -1){
FreqValue = req.substring(req.indexOf("=") + 1,req.indexOf("//"));
Serial.println("The Frequency Value is:");
Serial.print(FreqValue);
Serial.println();
Serial.println();
//Gets the new frequency number the user entered
FreqValueToSet = FreqValue.substring(0,FreqValue.indexOf("/"));
Serial.println("The Frequency Value is:");
Serial.print(FreqValueToSet);
Serial.println();
Serial.println();
FreqValueToSet.toCharArray(floatbuff, sizeof(floatbuff));
FreqValueNew = atoi(floatbuff);
Serial.println("Frequency is set to: ");
Serial.print(FreqValueNew);
//Set the Frequency
//analogWriteFreq(FreqValueNew);
}
I was having problems with my original code not working so I tried to rewrite it to make it better and below is what I thought would work better.
//Will give you the frequency value
String FVFind = req.substring(req.indexOf("l1"));
//Serial.println();
//Serial.println(FVFind);
String FV = FVFind.substring(3,FVFind.indexOf("/"));
Serial.println();
Serial.println(FV);
Serial.println("''''''''''");
float FVFloat = FV.toFloat();
Serial.println(FVFloat);
Serial.println("''''''''''");
I haven't done much programming before so I don't really know the best way's to do things.
Thank you for the help so far.