Jump to content

This is a cludged code example but still warrants the question why does the Serial println() prin...


G+_Rud Dog
 Share

Recommended Posts

Rud Dog I did look at it, of course. I see what you are saying, but that does not help answer where the other entry is coming from. The way you troubleshoot things like this is to experiment (I suggested commenting out lines 187 and 188 as a test).

I'm not that familiar with the webpage portion of your code. What is the purpose of lines 187 and 188 being in that location? Perhaps there is an unexpected interaction with client.println and the webpage code is "echoing" back your Serial.println ?

Just a guess ... today I dismantled the breadboard where I had your circuitry duplicated, so would have to put it all back together to try out your code.

If you could print here exactly what you are seeing, perhaps that would give a clue.

Are you seeing something like:

 

Current Draw is:

1.8

Printing Irms

1.8

Printing Irms

1.8

 

Or something different? (I made up the 1.8 obviously)

I don't see your body closing tag, so maybe you need a:

client.println("

Link to comment
Share on other sites

Keeping a focus on the problem; the web page prints Irms once while the serial monitor port print Irms twice. There is only one line of code calling out that unique print statement.

 

If I comment out lines 187 and 188

//Serial.println("Printing Irms");

//Serial.println(Irms);

(This was tried early on as the best practices step to figure out why the Serial.println() was printing twice. The results were)

And after that, no Printing Irms shows up either once or twice.

 

Added the client.println("

Link to comment
Share on other sites

Rud Dog When you originally asked "why does the Serial.println() print out the current twice in the com port output monitor?", you didn't show us an example of what was printing, and I thought you meant it was printing the same Irms value twice in the serial monitor (as shown by the example I made up).

Now that you've shown us what you are actually seeing, it's even more curious. The question now is not why is the Irms value printing twice, but rather why is it NOT printing 4 times!

The example you posted shows the line " Running void loop()" being printed 4 times in the serial monitor. That shows that the loop ran 4 times. My question (that I'm asking myself) is why it only printed the Irms 2 times in those 4 times?

I have taken your code and deleted all the other lines that do not pertain to this particular result, but have not yet discovered the cause.

Is there more that you are seeing in the serial monitor than you are posting here?

Link to comment
Share on other sites

Currently working on figuring out a way to bypass the fluctuating current during the wash cycle.

Getting back to the original question I don't know.

What is not clear to me is when the line for printing Irms has run it prints out two times there were others but that is acceptable as those are printed as it goes through the code again. (LOOP) I think.

 

Not sure how you are seeing four times but will review that when I reload the code into the device as stated I am working on getting around the odd low and hi currents during the cycle.

Link to comment
Share on other sites

John Sullivan Ok, think I got it figured out.

Notice two things: (1)your IF statements don't have options for all possible Irms readings

(2) this line of code:

if (!client) { return; }

 

Going back to the example you provided ( and I add numbers to), the loop continues until it runs the test for the wifi connection, which fails. When it hits that line (If(!client), there is no connection so it "returns" and starts the loop again.

 

You showed us four samples of the loop, two of which the Irms was below 2, so your code called to print the value. (numbers 1 and 3 in my example)

 

 

You also had two runs through the loop where the Irms was above 2 AND washer ==0, and you don't have any code to handle that, so it just printed "Running void loop()" (my examples #2 and 4)

 

 

 

 

 

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...