I saw this and thought what an interesting challenge.
I started out by making a pendulum swing on a string which is the code below.
I would advise running this at at least 8X acceleration in oricutron, although with the 2 draw commands and the wait removed it is not that bad on 1Mhz.
Code: Select all
20 GR=9.81:REM ACCELERATION DUE TO GRAVITY
30 SP=0 : REM INITIAL SPEED
40 LX=1 : REM CONTROLS AMPLITUDE X-AXIS
50 LY=1 : REM AMPLITUDE OF Y-AXIS
60 TH=PI/2 : REM START ANGLE
70 RD=110 : REM RADIUS OR LENGTH OF PENDULUM
80 PX=120 : REM X-AXIS CONNECTION OF PENDULUM
90 PY=20 : REM Y-AXIS CONNECTION OF PENDULUM
100 REM MAIN LOOP FOR CALC AND DRAWING
130 CURSET NX,NY,0
140 CIRCLE 2,1
150 REM REMOVE THIS DRAW FOR SMOTHER ANIM
160 DRAW PX-NX,PY-NY,1
200 REM REMOVE THIS WAIT IF DRAWS REMOVED
210 WAIT 10
220 CURSET NX,NY,0
230 CIRCLE 2,0
240 REM REMOVE THIS DRAW FOR SMOTHER ANIM
250 DRAW PX-NX,PY-NY,0
260 GOTO 100
The next step is to remove the y-axis pendulum calculation (ie NY=PY) which make it look like you're looking down on the pendulum from above.
So the ball would appear to move just left and right along an x-axis with simple harmonic motion.
Changing line 120 to 120 NY-=PY gives the effect described above.
So the next step would be to calculate a new value of Y. Well this is just another simple harmonic motion with a different frerquency to the x-axis frequency and to remnove the "undraw" commands.
Hopefully that will be the next post