Blynk - Interruption for data transmit

Greetings everybody,

I’m developing a project to measure the fermentation index of home made beer. I’m using bluetooth tecnology to transmit data, since the wifi does not work properly in the basement.

I can already acquire data and transmit it to a superchart in blynk app, however I want to implement this logic:

Store the measures in a vector. I don’t know yet the size of this vector( for testing purposes 50), but the objective is to acquire and store measures every 15minutes.

Them when I press a button, it will call a function/routine like an interruption. How can I call an interruption? I try to use blink blynk as example, cause it relies on event click, but its not the samething.


/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>


// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "3473f8737181435c96f0f379817e96c8";

/*
The simplest TMP 36 Thermometer
*/
const int analogIn = A4;

int RawValue= 0;
double Voltage = 0;
double tempC = 0;
double tempF = 0;
BlynkTimer timer;
double mySensVals[50] = {}; //This vector receives Voltage values. 
int i = 0; 

void setup(){  
  Serial.begin(9600);
  Serial3.begin(9600);
  Blynk.begin(Serial3, auth);

  Serial.println("Waiting for connections...");
  timer.setInterval(10000L, myTimerEvent);
  
}

BLYNK_WRITE(V1)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable

  if (pinValue = HIGH){
    for (int x=0; x<=49; x++){
    
     Blynk.virtualWrite(V5,  mySensVals[x]);
     Serial.println("Serial print");        //Serial printing values for test
     Serial.println( mySensVals[x]);        //Serial printing values for test
  }
  }else if{}


  
}

 
 for (int x=0; x<=49; x++){
    
     Blynk.virtualWrite(V5,  mySensVals[x]);
     Serial.println("Serial print");        //Serial printing values for test
     Serial.println( mySensVals[x]);        //Serial printing values for test
  }

  
}

void myTimerEvent()
{

 Serial.print("Checking first value of i: ");
 Serial.println(i);
  
  RawValue = analogRead(analogIn);
  Voltage = (RawValue / 1023.0) * 5000; // 5000 to get millivots.
 
  //tempC = (Voltage-500) * 0.1; // 500 is the offset
  //tempF = (tempC * 1.8) + 32; // conver to F  
  //Serial.print("Raw Value = " );  // shows pre-scaled value                    
  //Serial.print(RawValue);      
  //Serial.print("\t milli volts = "); // shows the voltage measured     
  //Serial.print(Voltage,0); //
  //Serial.print("\t Temperature in C = ");
  //Serial.print(tempC,1);
  //Serial.print("\t Temperature in F = ");
  //Serial.println(tempF,1);
  // You can send any value at any time.
  // Please don't send more that 10 values per second.

  mySensVals[i] = Voltage ;   //Not sure if mySensVals is a global variable, which means that once this function store values I can acess this vector on another function.
  Serial.print("Voltage: ");
  Serial.println( mySensVals[i]); 
  Serial.println("Checking sequence of i: ");
  Serial.println(i);
  i=i+1;

 }

void loop(){

  Blynk.run();
  timer.run();
  
}

An interruption of what?

In this code, the function myTimerEvent runs every 10 seconds. I want to press a button and interrupt this process (not sure tho if its really necessary) and display all current values stored in the vector mySensVals[]. First I tried to use another void function, but I think it could be possible to do it with BLYNK_WRITE.

All sorts of information about SimpleTimer (BlynkTimer) here… enabling, disabling, etc…

https://playground.arduino.cc/Code/SimpleTimer

10 seconds is a very long time, if you are a microcontroller. I see no reason whatsoever to use interrupts here since it’s not time critical in anyway.

Just make a function to display your values with a button. Your timer event will be executed very fast since it has no lenghty stuff in it.

I suspect the OP ment interrupting (AKA delaying, stopping, canceling, etc.) the otherwise regularly set BlynkTimer intervals… not a processor interrupt.

I’m guessing you mean an ‘array’ ? I’m doing something quite similar but not as an ‘interrupt’ (whatever you mean with that) but on the fly. I measure temp every minutes and store it in a 15 cell array with a FiFo construction. The result I get is an average over the last measured 15 values stored in the array.
You could do this with the press of a button as well (but I don’t see the point).