Skip to content

Commit

Permalink
Merge pull request #27 from rharbird/new_pxt
Browse files Browse the repository at this point in the history
Correct markdown syntax
  • Loading branch information
rharbird committed Sep 7, 2019
2 parents 921c270 + 2c14238 commit d54f192
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/sine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Note: the ``Math.sin()`` function requires that the number of degrees is express
* The 4000ms is the amount of time it takes to go from angle 0° back to 0° again. Make this number bigger to go slower.
* Sine values vary between 0 and 1 so the angle varies between 0° and 180° as things stand. The ``90 *`` is the amplitude of the wave and here we want it to go through all 180° of motion. Make this smaller if you want less; if the value was, say 40, then the movement would vary between 60° and 130°.
* The ``90 +`` is the centre position position of the movement. The servo moves equally either side of that centre. You could choose to centre the movement in a different place. If this was say, 100 and the amplitude was 40 then the servo would move between 60° and 140°.
* You could create variables for amplitude and time period, say ``A`` and ``T``, with another for the centre ``C``. This makes the formula: ``angle = C + A * Math.sin(2 * PI running_time() / T)
* You could create variables for amplitude and time period, say ``A`` and ``T``, with another for the centre ``C``. This makes the formula: ``angle = C + A * Math.sin(2 * PI running_time() / T)``
Congratulations! You made an oscillator. The nice thing about sinusoidal oscillators is that putting things out of phase is easy. Say you wanted two sine waves 90° out of phase then set:``angle1`` = sin(t) and ``angle2`` = sin(t + 90)

0 comments on commit d54f192

Please sign in to comment.