Shop OBEX P1 Docs P2 Docs Learn Events
PENGUIN ROBOT Round Number - the Code — Parallax Forums

PENGUIN ROBOT Round Number - the Code

HumanoidoHumanoido Posts: 5,770
edited 2007-12-06 06:35 in Robotics
Title: Penguin Round Number Program
Code Name: penguin_round_number.bpx
Purpose: Round a number using a mathematical remainder technique


This program takes an input number from 0 to 360, scales it by 6
division, determines the remainder, then rounds up when determined.
The scale is used for more accurately plotting circle angles for
compass code.

The input number is generated automatically and runs through the
complete set of angle values from 0 to 360 degrees. The scaled
number results from the 6 divisor. The remainder technique is
used determine the remainder of the scaled number. The
remainder is then used to round the final value, increasing the
accuracy of the final result. The data scrolls automatically on the
Debug screen.

The code is very useful for many compass programs that
require scaling from 0 to 360 degrees, or most angular code
that require data crunching and rounding.

humanoido
humanoido said...
This code is an integral part of the upcoming
Penguin Compass Plotter. With Compass Plotter, Penguin will report
cardinal compass positions to the Debug screen, scale, and graphically
plot to a virtual compass band, while constantly updating with real time
graphics.
Sign In or Register to comment.