I'm a little late to the table, here. To simulate a pendulum, its a cosine 
function, first mentioned by Erik. As Frank, also noted, calculate the 
values externally, and then load it as a lookup table, into your code. 
Speed and position, were also noted to be a derivative of each other. 
Fortunately, the derivative of a cosinewave is a sinewave, and both are 
really the same thing, only shifted a quarter of the way (90 degrees) off 
each other. That means you don't have to think too hard. Also a couple of 
the guys worked out the tables for you. For speed, or duration, just use 
the absolute value. I noticed one had negative numbers. Again don't worry 
about it too hard. Write and test the code. If it ends up its off, by 90 
degrees, just shift the table. Or better yet, add an offset constant to 
your lookup index. Add a simple "mod" limiter, so the index will wrap 
around. That way you can rotate the function, with adjusting just one value.

On Saturday, February 22, 2014 7:31:04 AM UTC-8, Bill v wrote:
>
> Hello,
>
>  
>
> I have built a clock controlled by a PIC with 6 numitrons in the centre. 
> Around them is a circle of 60LEDs which are programmed to display a number 
> of different patterns. I am currently working on a pendulum pattern which 
> uses the lower 30 LEDs. I have the software done, the challenge is this:
>
>  
>
> A pendulum has a period and an angular velocity that changes from 0 at the 
> ends, and maximum in the center, following an equation. In the software I 
> currently have 36 time slices (program steps, 0 to 35) in a half period of 
> 107 clock cycles, for a total of 3852 cycles for one swing (left or right). 
>
>  
>
> Looking at one swing, my challenge now is to divide the 36 program steps 
> of 107 clock cycles such that the total number of clock cycles remains 
> 3852, but the actual number of clock cycles per step are divided such as to 
> approximate the equation of one pendulum swing  (left or right). 
>
>  
>
> Anyone willing to take a stab at this?
>
>  
>
> Bill van Dijk
>

-- 
You received this message because you are subscribed to the Google Groups 
"neonixie-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/neonixie-l/d0946937-7e42-4eb5-8bf2-bd1144940d49%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to