Created
February 4, 2017 07:48
-
-
Save protongt/a59f57cca861868c37f497d268bc33de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "EmonLib.h" // Include Emon Library | |
#include <LCD5110_Graph_SPI.h> | |
EnergyMonitor emon1; // Create an instance | |
LCD5110 myGLCD (5,6,3); | |
extern unsigned char SmallFont[]; | |
extern unsigned char TinyFont[]; | |
void setup() | |
{ | |
Serial.begin(9600); | |
emon1.current(1, 111.1); // Current: input pin, calibration. | |
myGLCD.InitLCD(70); | |
myGLCD.setFont(SmallFont); | |
myGLCD.update(); | |
myGLCD.print("ENERGY MONITOR", CENTER, 5); | |
myGLCD.update(); | |
myGLCD.print("9W2NFE", CENTER, 15); | |
myGLCD.setFont(TinyFont); | |
myGLCD.print("9W2NFE.blogspot.com", CENTER, 25); | |
myGLCD.update(); | |
delay(3000); | |
myGLCD.clrScr(); | |
myGLCD.setFont(SmallFont); | |
myGLCD.update(); | |
} | |
void loop() | |
{ | |
double Irms = emon1.calcIrms(1480); // Calculate Irms only | |
Serial.print(Irms*230.0); // Apparent power | |
myGLCD.printNumF((Irms*230.0), 2, 10, 10); | |
myGLCD.print(" WATT", 40,10); | |
Serial.print(" "); | |
Serial.println(Irms); // Irms | |
myGLCD.printNumF(Irms, 2, 10, 20); | |
myGLCD.print(" AMP", 35,20); | |
myGLCD.update(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment