One of our newest members asked how to communicate between two Spike Prime hubs to control a car-like vehicle with one steering motor and two drive motors.
Fortunately, this works the same on any hub! This means you can combine any of the car tutorials with the wireless communication tutorial to build Spike Prime cars, too!
How it works
The two programs above illustrate how this works. One hub just broadcasts it pitch and roll values in a loop.
Any hub can receive these values, including a Spike powered car. The car can use the pitch for drive power and roll for steering. I've also added two math blocks to multiply the tilt values, so it steers a bit faster even for small amounts of tilt.
Further exploration
Pitch and roll are easy ways to get started, but can you think of more creative ways for drive power and steering input? Maybe you can...
... build a speed dial that returns to 0 when you release it.
... build a proper steering wheel around the hub.
... trigger the horn by pressing the button.
... have the car broadcast its speed value back to the remote, so you can display it.
Sofia M
2024-05-06 15:43:24 +0000 UTC