@@ -10,7 +10,7 @@ There are a few things that can be done with the power board, namely current and
10
10
As there is only one power board, it is not accessed like a list like ` motors ` and is instead accessed directly, for example:
11
11
12
12
~~~~~ python
13
- r .power_board.something...
13
+ R .power_board.something...
14
14
~~~~~
15
15
16
16
[ Power Outputs] ( #outputs ) {#outputs}
@@ -33,25 +33,25 @@ While they are all turned on when your code starts running,
33
33
from sr.robot3 import *
34
34
35
35
# Turn output H0 off
36
- r .power_board.outputs[OUT_H0 ].is_enabled = False
36
+ R .power_board.outputs[OUT_H0 ].is_enabled = False
37
37
38
38
# Turn output L0 on
39
- r .power_board.outputs[OUT_L0 ].is_enabled = True
39
+ R .power_board.outputs[OUT_L0 ].is_enabled = True
40
40
41
41
# Find out whether L3 is enabled
42
- print (r .power_board.outputs[OUT_L3 ].is_enabled)
42
+ print (R .power_board.outputs[OUT_L3 ].is_enabled)
43
43
44
44
# Find the current (in Amps) being used by L3
45
- print (r .power_board.outputs[OUT_L3 ].current)
45
+ print (R .power_board.outputs[OUT_L3 ].current)
46
46
~~~~~
47
47
48
48
An exception is raised if you try to set an output index which doesn't exist.
49
49
50
50
You can also control all the outputs together:
51
51
52
52
~~~~~ python
53
- r .power_board.outputs.power_off()
54
- r .power_board.outputs.power_on()
53
+ R .power_board.outputs.power_off()
54
+ R .power_board.outputs.power_on()
55
55
~~~~~
56
56
57
57
<div class =" warning " >
@@ -70,8 +70,8 @@ You can access these values like so:
70
70
~~~~~ python
71
71
# Print the battery voltage and current to the log
72
72
print (
73
- r .power_board.battery_sensor.voltage,
74
- r .power_board.battery_sensor.current,
73
+ R .power_board.battery_sensor.voltage,
74
+ R .power_board.battery_sensor.current,
75
75
)
76
76
~~~~~
77
77
@@ -109,10 +109,10 @@ between `C6` and `C8`. You can play other tones by providing a frequency.
109
109
from sr.robot3 import Note
110
110
111
111
# Beep for 0.5s in D.
112
- r .power_board.piezo.buzz(0.5 , Note.D6)
112
+ R .power_board.piezo.buzz(0.5 , Note.D6)
113
113
114
114
# Beep for 2s at 400Hz
115
- r .power_board.piezo.buzz(2 , 400 )
115
+ R .power_board.piezo.buzz(2 , 400 )
116
116
~~~~~
117
117
118
118
` ValueError ` is raised if the note is not recognised or the frequency is not an integer.
0 commit comments