11/15/2023 0 Comments Arduino delay statements in interruptsI am no friend of delay() except in the most simple cases as its always inaccurate. put your setup code here, to run once: Noah indent preformatted text by 4 spaces For pure testing purposes though, I created a sketch solely dedicated to tracking time. I understand this hinders everyone’s ability to help. It is for work, and somewhat sensitive, so I can reveal too many background details such as what I am actually sensing. I graphed the “time” over samples, and expected it to be a near linear, ever-increasing function. I have tried manipulating the baud from 9600 to 500000. I use an Arduino Mega 2560, power and serial comms over USB into my computer. I’m pretty inexperienced with Arduinos, and would appreciate any help I could get as to why the micros() function is capping out. It’s supposed to track up to I believe 70 days. However, regardless of whether I uses micros() or millis(), it caps out on each side: ~27000, and ~-32000. I am trying to use the micros() function to keep track of when I am reading these points. I would prefer to do anything less than one millisecond delay, and am hesitant to consider increasing it over that threshold for various reasons. Because I don’t want to miss any data points, I am using the delay() for half a millisecond (.5). I am using a sensor to track data, and I am trying to be precise as possible. I understand there are better places to ask questions referring to Arduinos than CD, although I have had good experiences in the past on CD, and also lack accounts to other popular technical forums.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |