Skip to main content
7 events
when toggle format what by license comment
May 17, 2018 at 12:23 comment added Ahmed K. Moustafa @dandavis can you please specify the units of the baud rate and the reading period. it is (bps / us = hz) ?? Thanks
Mar 22, 2018 at 19:50 comment added dandavis (1000000 / 4000) == 250 If 2000 works your timing is off.
Mar 22, 2018 at 19:14 comment added Ahmed K. Moustafa Thanks for your answer. I have tried the code, however, it gave sampling frequency 125 Hz. I tried playing with the READ_PERIOD and I found that 2000 gave sampling frequency of 250 Hz. What does this number stand for and what concept or equation is being used ? Many thanks !!
Mar 22, 2018 at 19:12 vote accept Ahmed K. Moustafa
Mar 21, 2018 at 22:12 comment added Edgar Bonet I took the liberty to do a few edits: use micros() instead of millis(), as the latter has 1 ms of jitter; write lastRead += READ_PERIOD instead of lastRead = now to prevent creeping drift; a few simplifications.
Mar 21, 2018 at 22:12 history edited Edgar Bonet CC BY-SA 3.0
`micros()` instead of `millis()`, avoid drift, simplifications.
Mar 21, 2018 at 20:32 history answered ratchet freak CC BY-SA 3.0