Hi everyone! First of all, thanks for reading!
I’m doing a big project in arduino pro mini, which has a physical button that I want to replace with a really simple Blynk app.
In this project, the Setup looks like
void Setup(){
Class.Method1();
Class.Method2();
Class.Method3();
}
Where the class is in a custom library.
In some of those functions I have a period of time in which I wait for the user to push the button.
the code is something like
buttonPushed=false;
t0=milllis();
while(t0-millis()<10000)// Check for 10 secs if the button was pushed
{
if(digitalRead(2)==HIGH) buttonPushed=true; //actually I use a debounce library, but you get the idea
}
if(buttonPushed=true) doSomething();
So I guess that if I have a button widget attached to pin 2, I shoud use “Blynk.run()” inside the while loop. And, in order to do that, I have to include BlynkSimpleSerialBLE.h and SoftwareSerial.h to my library, create the SoftwareSerial as a class atribute, and use it for the “Blynk.Begin()”.
I tried many ways, but I couldn’t make it work so far. I can get the first part right if Ideclare the SoftwareSerial as a pointer and initialize it in the constructor, but then I get an error on the Blynk.Begi(), because it doesn’t receives pointers.
Do you have any ideas?
Thank you very much!