Skip to content

Commit 3729d90

Browse files
authored
Merge pull request #339 from srobo/dgt/fix-motor-powers
Fix incorrect motor power values
2 parents 50c26c9 + ef363ae commit 3729d90

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

programming/sr/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ It handles all the low-level interactions so you don't have to.
1111
To set the output power of output 0 of the first motor board to -30%, for example, you would simply write:
1212

1313
~~~~~ python
14-
R.motors[0].m0.power = -30
14+
R.motor_board.motors[0].power = -0.3
1515
~~~~~
1616

17-
`-30` would be backwards (depending upon which way you wired up the motor) — 30% power in reverse.
17+
`-0.3` would be backwards (depending upon which way you wired up the motor) — 30% power in reverse.
1818

1919
To gain access to all of this functionality, all you need to do is write:
2020

@@ -45,9 +45,9 @@ Note that `motors`, `ruggeduinos`, and `servos` are Python lists, and so should
4545
Here are some examples:
4646

4747
~~~~~ python
48-
R.motor_board.motors[0].power = 50 # WILL work, if motor 0 exists
49-
R.motor_board.motors[1].power = -20 # WILL work, if motor 1 exists
50-
R.motor_board.motors.power = 42 # WON'T WORK
48+
R.motor_board.motors[0].power = 0.5 # WILL work, if motor 0 exists
49+
R.motor_board.motors[1].power = -0.2 # WILL work, if motor 1 exists
50+
R.motor_board.motors.power = 0.42 # WON'T WORK
5151

5252
# the above is similar to the situation for 'ruggeduinos' and 'servos'
5353
~~~~~

0 commit comments

Comments
 (0)