Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino source code for KC868-M16v2]-05 simple usage detect AC voltage
#1
Code:
/**
* This program shows you how to use the basics of this library.
*/

#include <ZMPT101B.h>

//#define SENSITIVITY 500.0f
#define SENSITIVITY 507.25f

// ZMPT101B sensor output connected to analog pin A0
// and the voltage source frequency is 50 Hz.
ZMPT101B voltageSensor(34, 50.0);

void setup() {
  Serial.begin(115200);
  // Change the sensitivity value based on value you got from the calibrate
  // example.
  voltageSensor.setSensitivity(SENSITIVITY);
}

void loop() {
  // read the voltage and then print via Serial.
  float voltage = voltageSensor.getRmsVoltage();
  Serial.println(voltage);

  delay(1000);
}
before use code, install zmpt101b arduino library firstly.
[Image: attachment.php?aid=2665]
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)