Looping without breaking the code with the Millis function

Has I also use my blog as a reference for myself, I mainly put this there for further reference. I usually use this lines of code to loop without stopping other functions from being executed or to time certain events. void myFunc() { unsigned long interval = 60 * 1000; // 60 seconds. static unsigned long previousMillis; if( millis() – previousMillis > interval ) { […]

Array of function pointers with mixed parameters

This is my work to create an array of function pointers which they can accept one parameter of any kind. /* 2010-10-18: Basics of array of function pointers. The trick here is to make these functions accept different types of parameters using a void pointer. */ // Define the function pointer type. // The void […]

Multitasking/multithreading in C on Arduino

Doing multitasking/multithreading on Arduino has an advantage, it’s give the possibility to read multiple captors, blink led and start a motor at virtually the same time. This is done by cycling rapidly (faster as the Arduino can) witting all the functions. I made up this code to execute many functions in the default cycling loop function […]