small medium large xlarge

Back to: All Forums  Arduino
09 Jan 2013, 01:20
robert creppy (1 post)

Hi Maik, I am newbie and enjoying the tutorials. I am not sure how the 16 (BUFFER_SIZE) readings are taken from the following lines of code (20, 21) without a loop.

buffer[axis][buffer_pos[axis]] = analogRead(PINS[axis]); buffer_pos[axis] = (buffer_pos[axis] + 1) % BUFFER_SIZE;

I will greatly appreciate your comments.

09 Jan 2013, 07:26
Maik Schmidt (117 posts)

Hi Robert!

I guess you’re talking about the Buffering.ino sketch?

Actually, there is a loop, but it’s implicit, because the Arduino calls the loop() function in an endless loop.

In the loop() function we call get_x(), get_y(), and get_z(), so get_axis() gets called three times whenever the Arduino calls loop().

Cheers, Maik

  You must be logged in to comment