https://github.com/codeadamca/spike-app
A basic example of using MicroPython and the app audio features on the LEGO Spike hub.
https://github.com/codeadamca/spike-app
lego mindstorms python
Last synced: 10 months ago
JSON representation
A basic example of using MicroPython and the app audio features on the LEGO Spike hub.
- Host: GitHub
- URL: https://github.com/codeadamca/spike-app
- Owner: codeadamca
- Created: 2022-07-06T20:53:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-26T22:28:17.000Z (12 months ago)
- Last Synced: 2025-01-26T23:23:10.432Z (12 months ago)
- Topics: lego, mindstorms, python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LEGO Spike Hub and the App Tools
A Python snippet utilizing the LEGO Spike app class to play sounds on the controlling device, [MicroPython](https://lego.github.io/MINDSTORMS-Robot-Inventor-hub-API/), and a variety of commands: `play_sound()`, `start_sound()`, and `stop_sound()`.
## Sample Code
```py
from mindstorms import MSHub, App
from mindstorms.control import wait_for_seconds
hub = MSHub()
app = App()
app.play_sound('Robot 1')
app.play_sound('Suction Cup')
app.play_sound('Train On Tracks')
app.start_sound('Service Announcement')
wait_for_seconds(0.5)
app.stop_sound()
hub.speaker.beep()
```
***
## Repo Resources
* [Visual Studio Code](https://code.visualstudio.com/)
* [MicroPython for LEGO Robot Inventor](https://www.lego.com/en-ca/themes/mindstorms/downloads)
* [LEGO Mindstorms](https://www.lego.com/en-ca/themes/mindstorms)
* [LEGO Mindstorms App for Mac](https://apps.apple.com/us/app/lego-mindstorms-inventor/id1515448947)
* [LEGO Mindstorms App for Android](https://play.google.com/store/apps/details?id=com.lego.retail.mindstorms)
* [LEGO Mindstorms App for Windows](https://www.microsoft.com/store/apps/9N7GN3KC2GK6)