Skip to content

Latest commit

 

History

History
37 lines (22 loc) · 1.24 KB

README.md

File metadata and controls

37 lines (22 loc) · 1.24 KB

QtLego

Action Status

A Qt library for connecting and controlling LEGO® devices.

THIS LIBRARY IS STILL IN ITS INFANCY! IT CAN ONLY HANDLE BASIC CONNECTIONS AND MOTOR COMMANDS!! EXPECT BREAKING CHANGES!!!

BuyMeACoffee

Introduction

QtLego is a library for connecting to LEGO devices and querying and controlling peripherals attached to those devices. Currently only LEGO Powered UP hubs are supported, but it should be possible to add support for Mindstorms and Spike Prime hubs.

Using

API

QLegoDevice

auto scanner = new QLegoDeviceScanner();

QObject::connect(scanner, &QLegoDeviceScanner::deviceFound, [=](QLegoDevice *device) {
  qDebug() << "Address:" << device->address();
  qDebug() << "Firmware:" << device->firmware();
  QTimer::singleShot(10000, device, &QLegoDevice::disconnect); // Disconnect after 10 seconds.
});

See examples/helloworld.cpp for a more complete example.

License

Copyright © Alex Shaw 2021

Source code is licensed under the MIT license.