Hi,
I am doing a project for a health device, I will be uploading ECG, temperature and an accelerometer.
I can only upload my x,y,z axis seperate as only a numerical value but any time I try and change it to a line graph it comes up as incompatible widget. Then when i do a custom widget it said no data. This is happening with the ECG too, i really need them as graphs, please help.
Also the data going over to cayenne from ECG only transmits every 20 seconds, just wondering is there a way to store the data until the cayenne gets the data. I tried working with eeprom but its complicated.
once you upload the code. the dashboard will be populated with a temporary green color widget. click on “+” add them to your dashboard.
click on the setting “gear icon” and change the choose widget to line chart.
in your code if (millis() - lastMillis > 2000) this line used to send data every 2 sec which I have changed to 10 sec as the sending data more then the rate limit will cause interrupt in connection. also, you were sending the acceleration value continuously so I have placed it inside the if function. have a look at this Sending MQTT messages within rate limits
I done what you said and this is what i am getting in now.
I need it to look like this graph in the serial monitor because it is what an ecg looks like but because it takes the values every 20 seconds the wave is just a random wave.
I just played around with what you wanted and made this a rough code. not sure whether it will work. give it a try.
int myPins[10];
void loop() {
Cayenne.loop();
int i;
for (i = 0; i < 10; i = i + 1) {
myPins[i] = analogRead(SENSOR_PIN2);
delay(100);
}
if (millis() - lastMillis > 10000) {
lastMillis = millis();
for (i = 0; i < 10; i = i + 1) {
Cayenne.virtualWrite(HEART_VIRTUAL_CHANNEL, myPins[i], "analog_sensor", "null");
delay(100);
}
}
}