Skip to content

Commit 866c858

Browse files
trickeydanPeterJCLawWillB97
authored
Apply suggestions from code review
Co-authored-by: Peter Law <[email protected]> Co-authored-by: Will Barber <[email protected]>
1 parent b2f575a commit 866c858

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

programming/sr/motors/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ R.motor_boards["srABC1"].something...
3939
Setting motor power
4040
-------------------
4141

42-
Motor power is controlled using [PWM](https://en.wikipedia.org/wiki/Pulse-width_modulation) with 100% power being a [duty cycle](https://en.wikipedia.org/wiki/Duty_cycle) of 1. You set the power with an integer value between -100 and 100 inclusive (where a negative value puts the motor in reverse). The field to change the output power is `power`. As each Motor Board has two outputs you will need to specify which output you want to control:
42+
Motor power is controlled using [PWM](https://en.wikipedia.org/wiki/Pulse-width_modulation) with 100% power being a [duty cycle](https://en.wikipedia.org/wiki/Duty_cycle) of 1. You set the power with an integer value between -1 and 1 inclusive. Fractional values (such as 0.42) can be used to specify less than 100% power. Negative values run the motor in the opposite direction.
43+
44+
The field to change the output power is `power`. As each Motor Board has two outputs you will need to specify which output you want to control:
4345

4446
~~~~~ python
4547
from sr.robot3 import *
@@ -69,7 +71,7 @@ You can read the current power value for a motor using the same field:
6971

7072
~~~~~ python
7173
# get the current output power of Motor Board srABC1, channel 0
72-
currentTarget = R.motor_boards["srABC1"].motors[1].power
74+
currentTarget = R.motor_boards["srABC1"].motors[0].power
7375
~~~~~
7476

7577
Stopping the motors

0 commit comments

Comments
 (0)