Process - JuliaElizabethLittle/peeMarksmanship GitHub Wiki
Our initial shot at creating a FlowDiagram to show the steps the Arduino would have to follow was the one you can see below:
#Old Flowchart:
What is it supposed to mean
It's meant to show that when the Arduino detects water (is this specific case piss) it checks the three sensors and and if any of them has any activity you add to the score (that had started off at 0) the value it is detecting times 20 if it is detected by the first sensor, by 10 if it's detected by the second sensor and by 5 if it's detected by the third sensor. After having added the score, for each sensor it would have to check if the toilet had been flushed (see if the button had been flushed) and then if it hadn't check the sensors again, and if it had add all three scores and pint the result on the LCD screen. Finally after a second it would restar at score = 0.
Why is it super wrong?
In this particular case we are asking the Arduino to check three sensors at the same time, and that's just not how Arduino works. Arduino follows the code in the loop, one step at a time, so it makes no sense to make a flow diagram with three choices for it can not do three tasks simultaneously.
#New Flowchart
What does it mean?
This diagram starts with score = 0. The first thing it does is check (analogRead) sensor A. If this sensor has a value above 0 you add the value times 20 to the score. Once that is done or if A equals 0 you proceed to the next sensor, B. You also check (analogRead) that one and repeat the same procedure as in the sensor A, except this time you multiply the result just by 10. As would be expected, you also follow the same steps for sensor C (this time multiplying the result of the sensor by 5). Once the three sensors have been checked (note that is this diagram checks one sensor at a time, as oposed to our initial one) it checks to see if the chain has been pulled (or the toilet has been flushed, for the non-british). It does this by digitallyReading a button. If it hasn't been pushed (therefore is LOW) It proceeds to checking the sensors again and restarts the loop. It it has been pushed (therefore is HIGH) it prints the value of SCORE (which will have added the result of each sensor every time one gave a value above 0) on a LCD screen, waits for a second and restarts the cycle from the beginning - setting the Score to 0.