Skip to content

Commit 1fa59dd

Browse files
Fixes to examples and readme
1 parent 776735d commit 1fa59dd

26 files changed

Lines changed: 789 additions & 454 deletions

examples/README.md

Lines changed: 74 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# Inventor HAT Mini Python Examples <!-- omit in toc -->
1+
# Inventor HAT Mini Examples <!-- omit in toc -->
22

33
- [Function Examples](#function-examples)
44
- [Read ADCs](#read-adcs)
5+
- [Set GPIOs](#set-gpios)
56
- [Read GPIOs](#read-gpios)
6-
- [Read Encoders](#read-encoders)
7+
- [Read Encoders](#read-encoders)
78
- [Read Internals](#read-internals)
8-
- [Read Ultrasound](#read-ultrasound)
99
- [LED Rainbow](#led-rainbow)
1010
- [Reset Inventor](#reset-inventor)
11-
- [Watchdog Demo](#watchdog-demo)
1211
- [Motor Examples](#motor-examples)
1312
- [Single Motor](#single-motor)
1413
- [Dual Motors](#dual-motors)
@@ -30,6 +29,16 @@
3029
- [Simple Easing](#simple-easing)
3130
- [Servo Wave](#servo-wave)
3231
- [Calibration](#calibration)
32+
- [Audio Examples](#audio-examples)
33+
- [Motor Song](#motor-song)
34+
- [Random Droid](#random-droid)
35+
- [Extra Examples](#extra-examples)
36+
- [GPIO Encoder](#gpio-encoder)
37+
- [Set Servo Pins](#set-servo-pins)
38+
- [Read Servo Pins](#read-servo-pins)
39+
- [Servo Pin Motor](#servo-pin-motor)
40+
- [Read Ultrasound](#read-ultrasound)
41+
- [Watchdog Reset](#watchdog-reset)
3342

3443

3544
## Function Examples
@@ -40,10 +49,16 @@
4049
Shows how to initialise and read the 4 ADC headers of Inventor HAT Mini.
4150

4251

52+
### Set GPIOs
53+
[set_gpios.py](set_gpios.py)
54+
55+
Shows how to initialise and 4 GPIO headers of Inventor HAT Mini as outputs and set them.
56+
57+
4358
### Read GPIOs
4459
[read_gpios.py](read_gpios.py)
4560

46-
Shows how to initialise and read the 4 GPIO headers of Inventor HAT Mini.
61+
Shows how to initialise the 4 GPIO headers of Inventor HAT Mini as inputs and read them.
4762

4863

4964
### Read Encoders
@@ -58,12 +73,6 @@ Demonstrates how to read the angles of Inventor HAT Mini's two encoders.
5873
Shows how to read the internal sensors of Inventor HAT Mini.
5974

6075

61-
### Read Ultrasound
62-
[read_ultrasound.py](read_ultrasound.py)
63-
64-
Control a HC-SR04 style ultrasonic distance sensor using the UART header on InventorHATMini.
65-
66-
6776
### LED Rainbow
6877
[led_rainbow.py](led_rainbow.py)
6978

@@ -188,3 +197,57 @@ An example of applying a wave pattern to a group of servos and the LEDs.
188197
[servos/calibration.py](servos/calibration.py)
189198

190199
Shows how to configure Inventor HAT Mini's servos with different common calibrations, as well as a completely custom one.
200+
201+
202+
## Audio Examples
203+
204+
### Motor Song
205+
[audio/motor_song.py](audio/motor_song.py)
206+
207+
A fun example of how to change a motor's frequency to have it play a song.
208+
209+
210+
### Random Droid
211+
[audio/random_droid.py](audio/random_droid.py)
212+
213+
Make your Inventor HAT Mini sound like an Astromech Droid!
214+
215+
This example uses the ttastromech library, for more details see https://pypi.org/project/ttastromech/
216+
217+
218+
## Extra Examples
219+
220+
### GPIO Encoder
221+
[extras/gpio_encoder.py](extras/gpio_encoder.py)
222+
223+
An example of how to read a rotary encoder connected to Inventor HAT Mini's GPIO pins.
224+
225+
226+
### Set Servo Pins
227+
[extras/set_servo_pins.py](extras/set_servo_pins.py)
228+
229+
Shows how to initialise and use Inventor HAT Mini's servo headers as 3.3V outputs and set them.
230+
231+
232+
### Read Servo Pins
233+
[extras/read_servo_pins.py](extras/read_servo_pins.py)
234+
235+
Shows how to initialise and use Inventor HAT Mini's servo headers as 3.3V inputs and read them.
236+
237+
238+
### Servo Pin Motor
239+
[extras/servo_pin_motor.py](extras/servo_pin_motor.py)
240+
241+
Shows how to use Inventor HAT Mini's Servo headers to control an externally connected motor driver.
242+
243+
244+
### Read Ultrasound
245+
[extras/read_ultrasound.py](extras/read_ultrasound.py)
246+
247+
Control a HC-SR04 style ultrasonic distance sensor using the UART header on InventorHATMini.
248+
249+
250+
### Watchdog Reset
251+
[extras/watchdog_reset.py](extras/watchdog_reset.py)
252+
253+
A demonstration of using Inventor HAT Mini's internal watchdog to stop motors from spinning when a simulated code lock-up occurs, by causing a board reset, and recovering from it.

0 commit comments

Comments
 (0)