here stream code github:
and here's code resulted crossing above code emon's monitoring code:
problem won't plot values serial monitor. i'm looking plot real power , rms current on time. i've tried replacing brackets content emon1.realpower, emon1.irms , realpower, irms (these last 2 roots cpp file).
code: [select]
#include <plotlyyun.h>
#include <yunmessenger.h>
#include <bridge.h>
#include <console.h>
// initialize plotly "plotters" unique token generated you
// when sign free account on plotly (https://plot.ly)
// find stream tokens in plotly account here: https://plot.ly/settings
// initialize many plotters want! each plotter send
// data same plot separate line.
plotly plotter("put_your_10_character_stream_token_here");
void setup() {
// start-up bridge , console
bridge.begin();
delay(2000);
console.begin();
while (!console) {
; // wait console port connect.
}
console.buffer(64);
delay(2000);
}
void loop() {
plotter.plot( analogread(a0) );
delay(100); // graph 10 points every second
}
and here's code resulted crossing above code emon's monitoring code:
code: [select]
#include <emonlib.h>
#include <plotlyyun.h>
#include <yunmessenger.h>
#include <bridge.h>
#include <console.h>
// emonlibrary examples openenergymonitor.org, licence gnu gpl v3
#include "emonlib.h" // include emon library
energymonitor emon1; // create instance
plotly plotter1("amrxgeikpf");
plotly plotter2("phw76cyuky");
void setup()
{
serial.begin(9600);
emon1.voltage(1, 170, 1); // voltage: input pin, calibration, phase_shift
emon1.current(0, 110); // current: input pin, calibration.
pinmode(2, output);
pinmode(3, output);
pinmode(4, output);
pinmode(5, output);
pinmode(6, output);
pinmode(7, output);
bridge.begin();
process p;
p.runshellcommand("/root/run_plotly.sh");
while (p.running()){ ; } // nothing until process finishes
delay(2000);
console.begin();
while (!console) {
; // wait console port connect.
}
console.buffer(64);
delay(2000);
plotter1.timezone = "america/montreal";
plotter2.timezone = "america/montreal";
}
void loop()
{
emon1.calcvi(20,2000); // calculate all. no.of half wavelengths (crossings), time-out
emon1.serialprint(); // print out variables (realpower, apparent power, vrms, irms, power factor)
float realpower = emon1.realpower; //extract real power variable
float apparentpower = emon1.apparentpower; //extract apparent power variable
float powerfactor = emon1.powerfactor; //extract power factor variable
float supplyvoltage = emon1.vrms; //extract vrms variable
float irms = emon1.irms; //extract irms variable
if (emon1.realpower>50) digitalwrite(2, high);
else digitalwrite(2, low);
if (emon1.realpower>200) digitalwrite(3, high);
else digitalwrite(3, low);
if (emon1.realpower>500) digitalwrite(4, high);
else digitalwrite(4, low);
if (emon1.realpower>1000) digitalwrite(5, high);
else digitalwrite(5, low);
if (emon1.realpower>2000) digitalwrite(6, high);
else digitalwrite(6, low);
if (emon1.realpower>3000) digitalwrite(7, high);
else digitalwrite(7, low);
plotter1.plot( realpower );
plotter2.plot( irms );
delay(100);
}
problem won't plot values serial monitor. i'm looking plot real power , rms current on time. i've tried replacing brackets content emon1.realpower, emon1.irms , realpower, irms (these last 2 roots cpp file).
if put "plotly" in title attract people can , save of cannot unnecessarily looking @ thread.
also looks yun question - why not moved yun section?
...r
also looks yun question - why not moved yun section?
...r
Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > Input values
arduino
Comments
Post a Comment