Skip to content

Commit

Permalink
Merge pull request #20 from rharbird/new_pxt
Browse files Browse the repository at this point in the history
New pxt
  • Loading branch information
rharbird committed Sep 7, 2019
2 parents 8819656 + 2a3be38 commit a908e58
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions docs/source/forwardAndBack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ We are going to move some of the code around. Any code that you put in the ``for

1. Move the code in the ``on button A pressed`` loop to the ``forever`` loop.
2. Delete the ``on button A pressed`` loop.
3. Add a pause of 180 milliseconds after the ``angle`` variable has been reset to 0. This is so that the micro:bit will wait for the motor to move to angle 0° before moving it again.
4. Add another 10 ms pause so that the micro:bit will wait for the servo motor to move each time around the ``forever`` loop.
3. Take a look at the diagram below, you will see that the motor takes almost 2000 milliseconds to move through 180°. Add a pause after the ``angle`` variable has been reset to 0. This is so that the micro:bit will wait for the motor to move to angle 0° before moving it again.
4. Add another pause so that the micro:bit will wait for the servo motor to move each time around the ``forever`` loop.
5. Experiment with the duration of the pauses until you have a smooth motor motion.

.. image:: pictures/degreesPerMs.png
:scale: 50%


Your code should now look like this:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/getReadyToCode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Get ready to code
*****************
We will be programming the micro:bit using the makecode programming environment
with some added software to drive the motors. Open a browser, and go to this
URL: `http://tiny.cc/mbit-servos <https://makecode.microbit.org/_DRA1LLC35E50>`_
URL: `http://tiny.cc/mbit-servos <https://makecode.microbit.org/_g9Y3i8X4A6pq>`_

When you see the screen below, press the ``Edit`` button.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/movingMotors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Click on the ``ServoBoard`` menu so that you can see the blocks.
.. image:: pictures/ServoBoardBlocks.png
:scale: 50%

Now drag out the blocks that will set up the motors and place them in the ``on start`` jaws so that your code looks like this:
Now drag out the blocks that will set up the motors and place them in the ``on start`` block so that your code looks like this:

.. image:: pictures/initialiseMotor.png
:scale: 50%
Expand Down
Binary file added docs/source/pictures/degreesPerMs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/pictures/servoBoardBlocks.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a908e58

Please sign in to comment.