This is an arduino sketch to control the assembled LEGO Technic vehicles via the Bluetooth LE interface and IMU sensor.
InstallationJust upload the sketch with your preferred IDE to the board. If you want to have debug information you might uncomment the #define DEBUG
line at the beginning of the sketch. If you do so and upload it to the remote it will wait after powered on until a serial terminal is connected.
- Lego Technic 4x4 Offroader 42099
ATTENTION: After you powered on the remote and pushed the green button on the Technic hub the vehicle will automatically steer to the left and right to measure the steering range and center position.
Power on your remote (Arduino Board). The easiest way might be to supply it via USB. Now it will scan for BLE Devices with the name Technic hub. If the central found one it will connect to it immediately and the blue LED on the board will be switched on. The remote will send some setup commands to the hub so the two motors on port A and B get mapped to one virtual port. For the last step the steering range and the central position for the steering will be initialized.
Steering the vehicleRotating the board around the Y-axes will increase/decrease speed. So you can move the vehicle forward and backward. Like in case rotating around the X-axes will allow you to turn left and right. The picture below shows the Arduino Nano 33 BLE Sense and its orientation to control a vehicle.
Useful LinksIf you use Microsoft Edge as your preferred browser use edge://bluetooth-internals/#adapter
in case of Google Chrome chrome://bluetooth-internals/#adapter
to investigate your bluetooth peripheral
Comments