Control your LEGO EV3 brick via direct commands - over Bluetooth, USB or Wi-Fi. Uses node-serialport.
Made in TypeScript!
The control code is an implementation of the official documentation available on the LEGO Mindstorms website - EV3 Firmware Developer Kit and EV3 Communication Developer Kit.
⚠⚠⚠ This package is not yet published to npm! For the time being you will have to clone this repository. ⚠⚠⚠
Connect your EV3 P-Brick over Bluetooth.
If you don't know the Bluetooth port the P-Brick is connected to, find it by Brick ID:
import { findBrickPort } from "ev3-direct";
findBrickPort("00112233aabb").then((brickPort) => {
console.log(brickPort);
});
Then send commands to your brick!
import { connectBrickByPort } from "ev3-direct";
connectBrickByPort("COM4").then(async (brick) => {
return brick.getBrickname();
}).then((resp) => {
console.log(resp);
}).catch((err) => {
console.error(err);
});
The EV3 class has only few basic methods implemented. To implement advanced logic, see custom requests