I have a very simple application running on a Particle Photon module here. Here is what that looks like:
// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>
// This #include statement was automatically added by the Particle IDE.
#include "PEFM.h"
//Object instance for PWM input board class library
PEFM controller;
//Authentication code for Blynk app running on phone.
char blynkAuth[] = "DeletedForSharingPurposes";
//Variables used for PWM publishing interval. Only publish every 1000 milliseconds.
unsigned long publishInterval = 1000;
unsigned long lastPubublish = 0;
void setup() {
//Configure Blynk
Blynk.begin(blynkAuth);
//Initialize controller with address jumper settings and frequency range.
controller.setAddress(0,0,0,0,controller.LowFrequency);
}
void loop() {
//Perform Housekeeping of Blynk connection
Blynk.run();
//Check Blynk publish interval for PWM input reading so we only publish every 1 second.
if(millis() > lastPubublish + publishInterval){
lastPubublish = millis();
//Read Frequency on channel 1 and publish to Blynk
char frequency[10];
sprintf(frequency, "%.2f Hz", controller.readFreq(1));
Blynk.virtualWrite(V0, frequency);
//Read Pulse Width on channel 1 and publish to Blynk
char pWidth[10];
sprintf(pWidth, "%.2f mS", controller.readPulseWidth(1));
Blynk.virtualWrite(V1, pWidth);
//Read Duty Cycle % on channel 1 and publish to Blynk
char dCycle[6];
sprintf(dCycle, "%i %%", controller.readDuty(1));
Blynk.virtualWrite(V2, dCycle);
}
}
Using a Graph and Label widget I am able to view the status of V0, V1, and V2 and they are correct. However When I add the History Graph Widget I get no Data, granularity is set to 1h and I let it sit and run for over an hour. Here is my setup in the app for the History Graph Widget:
I tried a get request to read V0 as documented here, the returned result is No data for pin.
Ideas on this? I know the History Graph has been discussed on the forum multiple times in the past and I have thoroughly read the Docs on it. I feel like I am doing this correctly but can’t figure out what is wrong.
Thank you @Eugene ,
Any idea what data types are accepted? ints, bytes, floats, doubles, etc? I can certainly understand why a string or char array would not be accepted. Just curios what is.
I do get a csv.gz file returned now when I do the HTTP Get request. I am now patiently waiting to see the history graph in the app display something other than No data I have it set to 1 hour granularity. Should it plot a new point on the graph once per Minute? That is what I gather from the doc.
Still not seeing anything after 10 minutes. I am getting the csv file on the http request. Here is what that looks like(Sorry would have uploaded screen shot but can only post one pic apparently):
// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>
// This #include statement was automatically added by the Particle IDE.
#include "PEFM.h"
//Object instance for PWM input board class library
PEFM controller;
//Authentication code for Blynk app running on phone.
char blynkAuth[] = "removed for sharing purposes";
//Variables used for PWM publishing interval. Only publish every 1000 milliseconds.
unsigned long publishInterval = 1000;
unsigned long lastPubublish = 0;
void setup() {
//Configure Blynk
Blynk.begin(blynkAuth);
//Initialize controller with address jumper settings and frequency range.
controller.setAddress(0,0,0,0,controller.LowFrequency);
}
void loop() {
//Perform Housekeeping of Blynk connection
Blynk.run();
//Check Blynk publish interval for PWM input reading so we only publish every 1 second.
if(millis() > lastPubublish + publishInterval){
lastPubublish = millis();
//Read Frequency on channel 1 and publish to Blynk
// char frequency[10];
float reading = controller.readFreq(1);
// sprintf(frequency, "%.2f Hz", reading);
Blynk.virtualWrite(V0, reading);
//Read Pulse Width on channel 1 and publish to Blynk
char pWidth[10];
sprintf(pWidth, "%.2f mS", controller.readPulseWidth(1));
Blynk.virtualWrite(V1, pWidth);
//Read Duty Cycle % on channel 1 and publish to Blynk
char dCycle[6];
sprintf(dCycle, "%i %%", controller.readDuty(1));
Blynk.virtualWrite(V2, dCycle);
}
}
No changes to History Graph widget settings in app. This is what I am seeing right now:
We can see by the most right time label on the X Axis that History Graph shows old data. Just tap on any time dimension button to refresh it manually. (We’ll be improving History Graph automatic refreshing in next updates.)