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();
}