https://github.com/slaveoftime/fun.lego.spike
csharp/dotnet wrapper for LEGO spike 3 hub repl
https://github.com/slaveoftime/fun.lego.spike
Last synced: 7 days ago
JSON representation
csharp/dotnet wrapper for LEGO spike 3 hub repl
- Host: GitHub
- URL: https://github.com/slaveoftime/fun.lego.spike
- Owner: slaveOftime
- License: mit
- Created: 2023-10-12T03:13:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-22T01:12:06.000Z (over 2 years ago)
- Last Synced: 2025-05-16T19:11:43.616Z (about 1 year ago)
- Language: C#
- Size: 236 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Fun.LEGO.Spike [](https://www.nuget.org/packages/Fun.LEGO.Spike)
Currently this library will use USB to connect to LEGO Spike hub 3 to interact it's python REPL. And it is just a dumb csharp wrapper to send python code to REPL and wait printed result from serial port.
Supported wrapper:
- LightMatrix
- ColorSensor
- Motor
- MotorPair
## How to use it
```csharp
using var services = new ServiceCollection()
.AddLogging()
.Configure(options => options.PortName = "COM5")
.AddSingleton()
.BuildServiceProvider();
var hub = services.GetRequiredService();
await hub.Connect(autoRetry: true);
var lightMatrix = new LightMatrix(hub);
await lightMatrix.SetOrientation(LightMatrixOrientation.LEFT);
await lightMatrix.Show(LightMatrixImage.IMAGE_BUTTERFLY);
```