Skip to content

Commit daea872

Browse files
committed
Documentation copy edit
1 parent 343f7df commit daea872

12 files changed

+23
-24
lines changed

buildhat/color.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, port):
2020
self._old_color = None
2121

2222
def segment_color(self, r, g, b):
23-
"""Returns the color name from HSV
23+
"""Returns the color name from RGB
2424
2525
:return: Name of the color as a string
2626
:rtype: str

buildhat/devices.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _hat(self):
6868

6969
@property
7070
def name(self):
71-
"""Determine name of device on port"""
71+
"""Determines name of device on port"""
7272
if self.connected == False:
7373
return "No device"
7474
elif self.typeidcur in self._device_names:

buildhat/distance.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def when_out_of_range(self, value):
101101
self.callback(self._intermediate)
102102

103103
def wait_for_out_of_range(self, distance):
104-
"""Waits until distance is farther than specified distance
104+
"""Waits until object is farther than specified distance
105105
106106
:param distance: Distance
107107
"""
@@ -112,7 +112,7 @@ def wait_for_out_of_range(self, distance):
112112
self._cond_data.wait()
113113

114114
def wait_for_in_range(self, distance):
115-
"""Waits until distance is closer than specified distance
115+
"""Waits until object is closer than specified distance
116116
117117
:param distance: Distance
118118
"""
@@ -126,7 +126,7 @@ def eyes(self, *args):
126126
"""
127127
Brightness of LEDs on sensor
128128
129-
:param \*args: Four Brightness arguments of 0 to 100
129+
:param \*args: Four brightness arguments of 0 to 100
130130
"""
131131
out = [0xc5]
132132
if len(args) != 4:

buildhat/force.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def threshold_force(self, value):
4949
self._threshold_force = value
5050

5151
def get_force(self):
52-
"""Returns the force in newtons
52+
"""Returns the force in (N)
5353
54-
:return: The force exherted on the button
54+
:return: The force exerted on the button
5555
:rtype: int
5656
"""
5757
return self.get()[0]

buildhat/matrix.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ class Matrix(Device):
77
"""LED Matrix
88
99
:param port: Port of device
10-
:raises DeviceInvalid: Occurs if there is no led matrix attached to port
10+
:raises DeviceInvalid: Occurs if there is no LED matrix attached to port
1111
"""
1212
def __init__(self, port):
1313
super().__init__(port)
1414
if self.typeid != 64:
15-
raise DeviceInvalid('There is not a led matrix connected to port %s (Found %s)' % (port, self.name))
15+
raise DeviceInvalid('There is no LED matrix connected to port %s (Found %s)' % (port, self.name))
1616
self.on()
1717
self.mode(2)
1818
self._matrix = [[(0,0) for x in range(3)] for y in range(3)]
1919

2020
def set_pixels(self, matrix):
2121
"""Write pixel data to LED matrix
2222
23-
:param pixels: 3x3 list of tuples, with color (0-9) and brightness (0-10) (see example for more detail)
23+
:param pixels: 3x3 list of tuples, with colour (09) and brightness (010) (see example for more detail)
2424
"""
2525
for x in range(3):
2626
for y in range(3):
@@ -65,7 +65,7 @@ def strtocolor(self, colorstr):
6565
def clear(self, pixel=None):
6666
"""Clear matrix or set all as the same pixel
6767
68-
:param pixel: tuple of color (0-9) or string and brightness (0-10)
68+
:param pixel: tuple of colour (09) or string and brightness (010)
6969
"""
7070
if pixel is None:
7171
self._matrix = [[(0,0) for x in range(3)] for y in range(3)]
@@ -89,7 +89,7 @@ def set_pixel(self, coord, pixel, display=True):
8989
"""Write pixel to coordinate
9090
9191
:param coord: (0,0) to (2,2)
92-
:param pixel: tuple of color (0-9) or string and brightness (0-10)
92+
:param pixel: tuple of colour (09) or string and brightness (010)
9393
:param display: Whether to update matrix or not
9494
"""
9595
if isinstance(pixel, tuple):

buildhat/motors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def stop(self):
183183
self.coast()
184184

185185
def get_position(self):
186-
"""Gets position of motor with relation to preset position (can be negative or positive).
186+
"""Gets position of motor with relation to preset position (can be negative or positive)
187187
188188
:return: Position of motor
189189
:rtype: int
@@ -209,7 +209,7 @@ def get_speed(self):
209209
@property
210210
def when_rotated(self):
211211
"""
212-
Handles rotatation events
212+
Handles rotation events
213213
214214
:getter: Returns function to be called when rotated
215215
:setter: Sets function to be called when rotated

docs/buildhat/colorsensor.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ ColorSensor
55

66
.. |location_link| raw:: html
77

8-
<a href="https://education.lego.com/en-gb/products/lego-technic-color-sensor/45605" target="_blank">LEGO Colour Sensor 45605</a>
8+
<a href="https://education.lego.com/en-gb/products/lego-technic-color-sensor/45605" target="_blank">LEGO Color Sensor 45605</a>
99

1010

11-
The LEGO® Education SPIKE™ Colour sensor can sort between 8 different colours and can measure reflected and ambient or natural light.
11+
The LEGO® Education SPIKE™ Color Sensor can sort between eight different colors and can measure reflected and ambient or natural light.
1212

1313
.. autoclass:: buildhat.ColorSensor
1414
:members:

docs/buildhat/distancesensor.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ DistanceSensor
88
<a href="https://education.lego.com/en-gb/products/lego-technic-distance-sensor/45604" target="_blank">LEGO Distance Sensor 45604</a>
99

1010

11-
The LEGO® Education SPIKE™ Colour sensor behaves like a conventional ultrasonic range finder but also has 4 LEDs that can be used to create the "eyes" of a robot. Each LED can be controlled individually.
11+
The LEGO® Education SPIKE™ Distance Sensor behaves like a conventional ultrasonic range finder but also has four LEDs that can be used to create the "eyes" of a robot. Each LED can be controlled individually.
1212

1313
.. autoclass:: buildhat.DistanceSensor
1414
:members:

docs/buildhat/forcesensor.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ForceSensor
88
<a href="https://education.lego.com/en-gb/products/lego-technic-force-sensor-by-lego-education/45606" target="_blank">LEGO® Force Sensor Set 45606e</a>
99

1010

11-
The LEGO® Education SPIKE™ Prime Force Sensor (also known as the LEGO® Technic Force Sensor) can measure pressure of up to 10 Newtons, but it can also be used as a touch sensor or a simple button.
11+
The LEGO® Education SPIKE™ Prime Force Sensor (also known as the LEGO® Technic Force Sensor) can measure pressure of up to 10 newtons (N), but it can also be used as a touch sensor or a simple button.
1212

1313

1414
.. autoclass:: buildhat.ForceSensor

docs/buildhat/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Library
44
=======
55

66
The Build HAT library has been created to support the Raspberry Pi Build HAT,
7-
an add-on board for the Raspberry Pi computer which allows control of up to 4 LEGO® Technic™ motors and sensors included in the SPIKE™ Portfolio.
7+
an add-on board for the Raspberry Pi computer, which allows control of up to four LEGO® Technic™ motors and sensors included in the SPIKE™ Portfolio.
88

99
.. image:: images/BuildHAT_closeup.jpg
1010
:width: 300
@@ -17,7 +17,7 @@ Other LEGO® devices may be supported if they use the LPF2 connector:
1717
:width: 100
1818
:alt: The LEGO LPF2 connector
1919

20-
In order to drive motors, your Raspberry Pi and Build HAT will need an external 7.5v
20+
In order to drive motors, your Raspberry Pi and Build HAT will need an external 7.5V
2121
power supply. For best results, use the official Raspberry Pi Build HAT power supply.
2222

2323
.. warning::

docs/buildhat/matrix.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Matrix
22
======
33

4-
The Spike 3x3 LED matrix has individual elements that can be set individually or as a whole.
4+
The LEGO® SPIKE™ 3x3 LED matrix has individual elements that can be set individually or as a whole.
55

66
Colours may be passed as string or integer parameters.
77

docs/buildhat/motor.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
Motor
22
=====
33

4-
Motors from he LEGO® Education SPIKE™ portfolio have an integrated rotation sensor (encoder) and can be positioned 1-degree accuracy. The encoders which can be queried to find the current
5-
position of the motor with respect to a 'zero' mark shown on the motor itself. Other motors
6-
without encodes will report a 0 value if queried.
4+
LEGO® Technic™ motors from the LEGO® Education SPIKE™ portfolio have an integrated rotation sensor (encoder) and can be positioned with 1-degree accuracy. The encoders can be queried to find the current
5+
position of the motor with respect to a 'zero' mark shown on the motor itself. Other motors without encoders will report a 0 value if queried.
76

87
|location_link1|
98

0 commit comments

Comments
 (0)