I have a sensor connected to the arduino uno pin 5 and it reads the sensor value every second and send out a sms every 1 minute. This works.
void loop() {
// read_sensor_and_store(5);
// increment_time_counter();
// if_time_counter is 60000 miliseconds then send the sms
delay(1000);
}
While this works, I want to call another function, say, read_another_sensor(pin, delay_0, count). What this will do is read the particular pin 'count' number of times with delay of 'delay_0'. (baically it will run a for loop with the given delay).
Now if I have something like this
void loop() {
// read_sensor_and_store(5);
// read_another_sensor(7, 2000, 4);
// increment_time_counter();
// if_time_counter is 60000 miliseconds then send the sms
delay(1000);
}
This too will work but while executing the read_another_sensor() the time will elapse and I will miss few readings of pin 5. Is there a way to execute these two functions in parallel or any other way to achieve the objective of "calling of read_another_sensor will not affect the continuous periodic functionality of read_sensor_and_store"
Appreciate any insight on this matter. Thank you