Guest User

Untitled

a guest
Jun 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. max = 0;
  2. t = millis();
  3. while (1)
  4. {
  5. instantCurrent = readAnalog();
  6. if (instantCurrent > max)
  7. max = instantCurrent;
  8. if (millis() - t > 1/50) //period is over.
  9. { // prepare for the next maximum in the next period
  10. Irms = max/sqrt(2);
  11. AveragePower = 220 * Irms / 50; // --> THAT'S WHAT I WANT
  12. t = millis();
  13. max = 0;
  14. }
  15. }
Add Comment
Please, Sign In to add comment