Plotting points on a circle
Newzed
Posts: 2,503
Here is a neat little program. It only took about four hours to write but it took me four days to figure out how to write it.
Anyway, the program plots 3, 4, 5, 6 and 15 points in each quadrant of a circle. This is equivalent to 12, 16, 20, 24 or 60 points on a circle.
The 15 point routine is specifically for a clock, and by default prints coordinates for a 4-inch diamter circle. I laid it out in ExpressPCB using T1-3/4 LEDs for the hour points and T1 LEDs for the minute points.
Instructions In Program Notes at the beginning of the program tell you how to program for different radius circles. When you load the program it will ask for the number of points per quad. Key in
the number, then press Enter. The program will prompt you to press any key to start.
This program is written for a BS2E but will work on any Stamp from a BS2 on up. It might even work on a BS1 –didn’t try it so I don’t know.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
Comments
I'm curious, why did you use LOOKUPs instead of the SIN and COS operators?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
sine = SIN (degr * 128 / 180)················
DEBUG "Angle: ", DEC degr, TAB
DEBUG "Sine:· ", SDEC sine, CR
but when I plotted them, the coordinates were not very close.· That's when I decided to use the lookup tables.· As far as I could tell, the coordinates were perfect when using LOOKUP.
Is there a better way to do it?
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com