Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
641 B

/*
EmonLiteESP
Energy Monitor Library for ESP8266 based on EmonLib
Currently only support current sensing
*/
#ifndef EmonLiteESP_h
#define EmonLiteESP_h
#define ADC_BITS 10
#define ADC_COUNTS (1<<ADC_BITS)
class EnergyMonitor {
public:
void initCurrent(unsigned int pin, double ref, double ratio);
double getCurrent(unsigned int samples);
byte getPrecision();
void setPrecision(byte precision);
private:
unsigned int _currentPin;
double _referenceVoltage;
double _currentRatio;
double _currentMidPoint;
double _currentFactor;
byte _precision;
double _multiplier;
};
#endif