SHARE
TWEET

NodeMCU_SCT-013_Current_Sensing_Settle?

Ruddog Nov 19th, 2018 34 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "EmonLib.h"                    // Include Emon Library
  2. EnergyMonitor emon1;                    // Create an instance
  3.  
  4. void setup()
  5. {
  6.   Serial.begin(115200);
  7.   delay(1000);
  8.   emon1.current(A0, 111.1);// Current: input pin, cal
  9.  
  10. }
  11. double Irms = emon1.calcIrms(1480);  // Calculate Irms only
  12. void loop()
  13. {
  14. delay(1000);
  15. Irms = emon1.calcIrms(1480);  // Calculate Irms only
  16.  
  17. if (Irms < .2)
  18. {
  19.   Serial.println("No Current");
  20.   Serial.println(Irms);
  21. }
  22. else if (Irms >= 1.2)
  23. {
  24.   Serial.println("Current ON");
  25.   Serial.println(Irms);
  26. }
  27. else
  28. {
  29.   Serial.println("Transtion between on and off or visa versa");
  30. }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top