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;
  • So how do you set a variable to zero? – romkey Jan 23 at 20:09
  • are micros() effective for this? – Giddsec Jan 24 at 4:38
  • You are missing a lot of context on this question. Can you post the entire program? – Eugenio Pace Jan 24 at 5:23
  • Yea sorry, got it working already, after HTTP.POST, I put total = 0; – Giddsec Jan 24 at 5:58

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

  • yea got it already, btw thanks for answering :) – Giddsec Jan 24 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.