TL;DR
Redeem channel points and a real launcher fires a ping-pong ball at me. It's an ESP32 driving a relay and motor, triggered by MBC over a local HTTP endpoint.
From Redemption to Launch
Redeem
A viewer redeems the launcher reward on Twitch.
Queue
MBC adds the shot to the launcher queue.
Trigger
MBC calls triggerPingPongLauncher, which POSTs to the ESP32's local endpoint.
Launch
The ESP32 closes the relay and runs the motor for about 2.3 seconds, then the next queued shot can fire.
Problems & Solutions
- 01
Overlapping redemptions
ProblemIf several viewers redeemed at once, the launcher could receive overlapping motor commands.
FixA software queue serializes requests. Shots fire one after another, and viewers can still stack up several.
LessonEvent-driven design doesn't stop at software. Physical devices need the same concurrency control.
- 02
Tuning the motor run
ProblemThe right motor run time for a single launch had to be found by testing.
FixAfter trials at longer durations, I tuned the run to about 2300 ms per launch.