I’m Marco and I’m quite new with Photons and Electrons. I’m encountering some problems in setting up a new project: I would like to read a frequency input: the system is the same of a bike computer, simply it counts the times that the magnet in the wheel pass through the sensor. Now I’m not taking about bicycles, but cars (I have 8 magnets in a single wheel. No matter, just faster readings).
I found that the pulseIn() function do exactly what I need, and obviously it simplifies a lot the programming process. My problem is when I try to read 4 wheel rotation speeds and I want that the loop() is always at 10Hz. I have to read one wheel at time, but every response is depending on the wheel speed (the faster you go, the faster is the time between readings).
I would like to separate the readings of the wheel from the loop function, trying to create two or more threads. Is it possible to do that or multithreading is available only for Cloud Backgrounds?
Have you any idea on how can I solve the problem?
Thanks in Advance!