.as help introduce heartbeat code with piezo piezoelectric sensor


.as help introduce heartbeat code with piezo sensor piezoelectric arduiono.

hello everyone, I wanted to run this project for detection of the heartbeat using the piezoelectric sensor I found the code but do not know how configurallo of cayenne and a little help can

int threshold = 60;
int oldvalue = 0;
int newvalue = 0;
unsigned long oldmillis = 0;
unsigned long newmillis = 0;
int cnt = 0;
int timings[16];

void setup() {

void loop() {
oldvalue = newvalue;
newvalue = 0;
for(int i=0; i<64; i++){ // Average over 16 measurements
newvalue += analogRead(A2);
newvalue = newvalue/64;
// find triggering edge
if(oldvalue<threshold && newvalue>=threshold){
oldmillis = newmillis;
newmillis = millis();
// fill in the current time difference in ringbuffer
timings[cnt%16]= (int)(newmillis-oldmillis);
int totalmillis = 0;
// calculate average of the last 16 time differences
for(int i=0;i<16;i++){
totalmillis += timings[i];
// calculate heart rate
int heartrate = 60000/(totalmillis/16);

thank you for your availability
The project called cayenne and congratulations like such a


Hi @itec.impianti.elettr,

Welcome to the Cayenne community! Have your checked out our documentation that goes over how to send data to Cayenne?