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 )
67 - [ 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 )
3029 - [ Simple Easing] ( #simple-easing )
3130 - [ Servo Wave] ( #servo-wave )
3231 - [ Calibration] ( #calibration )
32+ - [ Audio Examples] ( #audio-examples )
33+ - [ Play Sound] ( #play-sound )
34+ - [ Motor Song] ( #motor-song )
35+ - [ Random Droid] ( #random-droid )
36+ - [ Extra Examples] ( #extra-examples )
37+ - [ GPIO Encoder] ( #gpio-encoder )
38+ - [ Set Servo Pins] ( #set-servo-pins )
39+ - [ Read Servo Pins] ( #read-servo-pins )
40+ - [ Servo Pin Motor] ( #servo-pin-motor )
41+ - [ Read Ultrasound] ( #read-ultrasound )
42+ - [ Watchdog Reset] ( #watchdog-reset )
3343
3444
3545## Function Examples
4050Shows how to initialise and read the 4 ADC headers of Inventor HAT Mini.
4151
4252
53+ ### Set GPIOs
54+ [ set_gpios.py] ( set_gpios.py )
55+
56+ Shows how to initialise and 4 GPIO headers of Inventor HAT Mini as outputs and set them.
57+
58+
4359### Read GPIOs
4460[ read_gpios.py] ( read_gpios.py )
4561
46- Shows how to initialise and read the 4 GPIO headers of Inventor HAT Mini.
62+ Shows how to initialise the 4 GPIO headers of Inventor HAT Mini as inputs and read them .
4763
4864
4965### Read Encoders
@@ -58,12 +74,6 @@ Demonstrates how to read the angles of Inventor HAT Mini's two encoders.
5874Shows how to read the internal sensors of Inventor HAT Mini.
5975
6076
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-
6777### LED Rainbow
6878[ led_rainbow.py] ( led_rainbow.py )
6979
@@ -188,3 +198,63 @@ An example of applying a wave pattern to a group of servos and the LEDs.
188198[ servos/calibration.py] ( servos/calibration.py )
189199
190200Shows how to configure Inventor HAT Mini's servos with different common calibrations, as well as a completely custom one.
201+
202+
203+ ## Audio Examples
204+
205+ ### Play Sound
206+ [ audio/play_sound.py] ( audio/play_sound.py )
207+
208+ Play a WAV audio file from your Inventor HAT Mini!
209+
210+
211+ ### Motor Song
212+ [ audio/motor_song.py] ( audio/motor_song.py )
213+
214+ A fun example of how to change a motor's frequency to have it play a song.
215+
216+
217+ ### Random Droid
218+ [ audio/random_droid.py] ( audio/random_droid.py )
219+
220+ Make your Inventor HAT Mini sound like an Astromech Droid!
221+
222+ This example uses the ttastromech library, for more details see https://pypi.org/project/ttastromech/
223+
224+
225+ ## Extra Examples
226+
227+ ### GPIO Encoder
228+ [ extras/gpio_encoder.py] ( extras/gpio_encoder.py )
229+
230+ An example of how to read a rotary encoder connected to Inventor HAT Mini's GPIO pins.
231+
232+
233+ ### Set Servo Pins
234+ [ extras/set_servo_pins.py] ( extras/set_servo_pins.py )
235+
236+ Shows how to initialise and use Inventor HAT Mini's servo headers as 3.3V outputs and set them.
237+
238+
239+ ### Read Servo Pins
240+ [ extras/read_servo_pins.py] ( extras/read_servo_pins.py )
241+
242+ Shows how to initialise and use Inventor HAT Mini's servo headers as 3.3V inputs and read them.
243+
244+
245+ ### Servo Pin Motor
246+ [ extras/servo_pin_motor.py] ( extras/servo_pin_motor.py )
247+
248+ Shows how to use Inventor HAT Mini's Servo headers to control an externally connected motor driver.
249+
250+
251+ ### Read Ultrasound
252+ [ extras/read_ultrasound.py] ( extras/read_ultrasound.py )
253+
254+ Control a HC-SR04 style ultrasonic distance sensor using the UART header on InventorHATMini.
255+
256+
257+ ### Watchdog Reset
258+ [ extras/watchdog_reset.py] ( extras/watchdog_reset.py )
259+
260+ 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