
Doing the Math • Chapter 12 223
imum value of SIZE is the total number of variables allowed by the LEGO
firmware, which is 32. Each array element counts as a variable.
Weighted Averages
We explained that simple averages have the property of smoothing peaks and val-
leys in your data. Sometimes, though, you want to smooth data to reduce the
effect of single readings, yet at the same time put more importance on recent
values than older ones. In fact, the more recent the data, the more representative
the possible trend in the readings.
Let’s suppose your robot is navigating a black and white pad, and that it’s
crossing the border between the two areas.The ...