Pages: [1]   Go Down
Author Topic: Serial buffering for Arduino RC Car  (Read 1119 times)
0 Members and 1 Guest are viewing this topic.
Dubai, UAE
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to know how to introduce a delay to my received serial data (like 5 seconds) before arduino executes the move commands for the RC car. Please note the control signals must be processed after 5 seconds  smiley (pipelined,buffered), and does not mean that the processing occurs at 5 second intervals  smiley-cry . I have an Arduino Uno Rev 3.
« Last Edit: February 26, 2013, 06:45:27 am by abdulazam001 » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I want to know how to introduce a delay to my received serial data (like 5 seconds) before arduino executes the move commands for the RC car.
On each pass through loop(), see if there is serial data. If so, read it. If the data completes a packet, store the time the packet arrived, in one queue. Store the command itself in another queue.

On each pass through loop, see if it is time to execute the first command in the queue. If so, execute it, dequeuing it and the time. It will be time if now minus then (when the command arrived) is greater than the interval you want ("like 5 seconds").
Logged

Dubai, UAE
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you PaulS, it worked brilliantly!
Logged

Pages: [1]   Go Up
Jump to: