'================================================= 'Fibonacci Spiral 'by T.Whitfield Stodghill, III 'May 4, 2015 'Inspired by Nikos Giannakopoulos Artist Robot '================================================= ' 'Load program and place pen in pen port. Press the 'reset button to run program. S2 will scribble a 'Fionacci Spiral. ' CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ s2 : "s2" PUB start s2.start 'Start the S2 object s2.start_motors 'Start the motor cog. s2.button_mode(true, true) 'Set button mode to display in LEDs and to reset. s2.set_led(s2#POWER, s2#BLUE) 'Turn on the power LED. s2.set_wheel_calibration(s2#DEFAULT_FULL_CIRCLE -5, s2#DEFAULT_WHEEL_SPACE) 'Per Phil Pilgirm (your milage may vary) if (s2.reset_button_count) 'Do only if reset was via a button, rather than powerup. s2.set_speed(7) 'Set speed to 50%. s2.here_is(0, 0) 'Set the start point s2.begin_path 'Begin a smooth drawing path. s2.arc_deg(90, 10) 'Curve ccw 90 degrees with a radius of 10 s2.arc_deg(90, 20) 'Curve ccw 90 degrees with a radius of 20 s2.arc_deg(90, 30) 'Curve ccw 90 degrees with a radius of 30 s2.arc_deg(90, 50) 'Curve ccw 90 degrees with a radius of 50 s2.arc_deg(90, 80) 'Curve ccw 90 degrees with a radius of 80 s2.arc_deg(90, 130) 'Curve ccw 90 degrees with a radius of 130 s2.arc_deg(90, 210) 'Curve ccw 90 degrees with a radius of 210 s2.arc_deg(90, 340) 'Curve ccw 90 degrees with a radius of 340 s2.arc_deg(90, 550) 'Curve ccw 90 degrees with a radius of 550 s2.arc_deg(90, 890) 'Curve ccw 90 degrees with a radius of 890 s2.end_path 'End the drawing path. '---[End of Program]----------------------------------------------------------- {{ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TERMS OF USE: MIT License │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │ │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │ │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│ │is furnished to do so, subject to the following conditions: │ │ │ │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│ │ │ │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │ │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │ │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │ │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ }}