user71845: I have a project that records interrupts from a reed switch to nodemcu.
It records like this: 0.3,0.6,0.9,1.2 Then what I want to happen is to go back to zero when it successfully HTTP.POST to a webserver.
How can I do it? Thanks!
volatile float rainrate = 0.3;
volatile float total;

void count {
  total += rainrate;
}


user71912: Try putting your total variable to 0, like this:
total = 0;
It should work like this.

71845: <p>I have a project that records interrupts from a reed switch to nodemcu.</p>
<p>It records like this: 0.3,0.6,0.9,1.2 Then what I want to happen is to go back to zero when it successfully HTTP.POST to a webserver.</p>
<p>How can I do it? Thanks!</p>
<pre class="lang-cpp prettyprint-override"><code>volatile float rainrate = 0.3;
volatile float total;

void count {
  total += rainrate;
}
</code></pre>
 71912: <p>Try putting your <code>total</code> variable to <code>0</code>, like this:
<code>total = 0;</code>
It should work like this.</p>
