I have a program which loop runs every 20 ms. Inside the loop,
1, There is index variable which will increase the every time loops runs ( Index ++) 2. there is analog read function reads the Noise sensor every time loops runs 3. If index ==2, i.e 40 ms, I will call another function which will receive data from Xbee ( connected to FIO board) and control Air-condition via IR LED attached to FIO. 4. Some other function also executed when index reach certain number like index ==10
Now, the question is, 1. Is the loops runs every 20ms, and Analog read function executed for every 20ms and other functions inside also executed depending on index? Will it affect the performance of the program? or some reading may missed. Is it right design of to do? I believe that, Analog read happens in Micro seconds . Loop runs in Milliseconds. Right? Any issues here?
- Another idea, instead of Index, i can use time, to call function and read Sensor pin with 2 different loops from main. Like explained here: http://forum.arduino.cc/index.php?PHPSESSID=34u9s47j2l44vdbtmodfln43u7&topic=45649.15&token=uEaeck32QUfH8FsnVejp
Any thoughts /suggestion welcome? Thanks a lot
With regards, Chandra