Skip to content

Instantly share code, notes, and snippets.

# This is the car code for the remote controlled Tank-like vehicle
# Build one by slapping two motors on the side of your hub.
# (c) 2021 Anton's Mindstorms & Ste7an
# Use with the the remote control tutorial here:
# [url]
# Most of it is library bluetooth code.
# Scroll to line 200 for the core program.
@antonvh
antonvh / main.py
Last active October 19, 2023 08:10
PS3/PS4 LEGO MINDSTORMS remote control script with front wheel calibration and shoulder button trim.
#!/usr/bin/env pybricks-micropython
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import (Port, Stop, Direction, Button, Color,
SoundFile, ImageFile, Align)
from pybricks.tools import print, wait, StopWatch
import struct
# Hub to hub remote control program. Run this on the remote control
# Full tutorial here:
# https://antonsmindstorms.com/2021/06/19/how-to-remote-control-lego-spike-prime-and-robot-inventor-with-python/
# TO STOP THIS SCRIPT ALWAYS USE THE BUTTON ON THE HUB.
# AVOID THE STOP BUTTON IN THE MINDSTORSM APP!
# Building instructions here:
# https://antonsmindstorms.com/product/remote-control-transmitter-with-mindstorms-51515/