Void Statements which have no connection with Blynk

I have a question relating to my aquarium controller I am currently working on. I have to write some code which will turn on a fan when the temperature of the LED heatsink goes to high. That is simple enough, however since the Void Loop has to be kept clean how do I implement this into my code as it obviously cannot go within the Loop. This statement will run in the background without any UI on the app.

Any help will be greatly appreciated

Thanks M
Mariano

Using a timer. Read section 2 of this document for more info…

Pete.

Ok I get that, but the example assigns a Virtual pin to the function which in turn I assume will correspond wit a widget. What if you don’t need a widget do you still assign a Virtual pin?

In the example, it says:
:point_right:Next, you create a function describing what should actually happen every second:
We will read a sensor connected to A5, and then send it to Blynk app to Virtual Pin V1:”

I your case that function would do things like:

  • Take a temperature reading
  • Activate or deactivate your fan depending on the results

If you also wanted to push this information out to Blynk, to display the heatsink temperature and show if the fan is running, maybe using an LED widget then you could, but its not compulsory.

Pete.

By the way, I think the topic title is missing the word “loop” (e.g., “void loop() Statements which …”).

Ahhh… Got you. Thanks. I actually thought the timer function was part of the Blynk setup but have just realised it actually is part of the Arduino Library set.

Thanks

mariano

SimpleTimer is part of the Arduino library.

BlynkTimer is a modified (improved?) version of that, which is built in to the Blynk library. You’ll probably save memory if you use BlynkTimer rather than include SimpleTimer.

Pete.

Ok thanks