Skip to content

Commit

Permalink
Add doc & example for headlight support
Browse files Browse the repository at this point in the history
  • Loading branch information
ysard committed Dec 21, 2021
1 parent 610410f commit e5c22c5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ If you have Vernie assembled, you might run scripts from [`examples/vernie`](exa
- [vision sensor](docs/VisionSensor.md): several modes to measure distance, color and luminosity
- [tilt sensor](docs/TiltSensor.md) subscription: 2 axis, 3 axis, bump detect modes
- [RGB LED](docs/LED.md) color change
- [Headlight](docs/Headlight.md) brightness change
- [push button](docs/MoveHub.md#push-button) status subscription
- [battery voltage and current](docs/VoltageCurrent.md) subscription available

Expand Down
20 changes: 20 additions & 0 deletions docs/Headlight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Headlight

You can set the brightness of the LEDs of this set using the `LEDLight` class and its
`set_brightness` method. Accepted values are between 0 and 100%.

Example to make the LEDs blink:

```python
import time
from pylgbst.hub import MoveHub

hub = MoveHub()
# Blink forever
while True:
# Headlight is on port D; set its brightness to 100%
hub.port_D.set_brightness(100)
time.sleep(1)
# Shutdown the ligth
hub.port_D.set_brightness(0)
```
3 changes: 2 additions & 1 deletion docs/Peripherals.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Here is the list of peripheral devices that have dedicated classes in library:

- [Motors](Motor.md)
- [RGB LED](LED.md)
- [Headlight](Headlight.md)
- [Tilt Sensor](TiltSensor.md)
- [Vision Sensor](VisionSensor.md) (color and/or distance)
- [Voltage and Current Sensors](VoltageCurrent.md)
Expand All @@ -19,6 +20,6 @@ It is possible to subscribe with multiple times for the same sensor. Only one, v

Good practice for any program is to unsubscribe from all sensor subscriptions before exiting, especially when used with `DebugServer`.

## Generic Perihpheral
## Generic Peripheral

In case you have used a peripheral that is not recognized by the library, it will be detected as generic `Peripheral` class. You still can use subscription and sensor info getting commands for it.

0 comments on commit e5c22c5

Please sign in to comment.