# @highflying/circuit-cube

> A Javascript module to interface with LEGO Powered Up components.

Latest version **1.0.11** (published 2023-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @highflying/circuit-cube
pnpm add @highflying/circuit-cube
yarn add @highflying/circuit-cube
bun add @highflying/circuit-cube
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2023-03-06 |
| First published | 2023-03-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 37.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ben Rogers |
| Maintainers | highflying |

## Links

- npm: https://www.npmjs.com/package/@highflying/circuit-cube
- Homepage: https://github.com/highflying/circuit-cube
- npm.io page: https://npm.io/package/@highflying/circuit-cube

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^4.3.3
- [@abandonware/noble](https://npm.io/package/@abandonware/noble.md) 1.9.2-15

## Recent versions

- 1.0.11 (latest) — 2023-03-06
- 1.0.10 — 2023-03-06
- 1.0.9 — 2023-03-06
- 1.0.8 — 2023-03-06
- 1.0.7 — 2023-03-06
- 1.0.6 — 2023-03-06
- 1.0.5 — 2023-03-06
- 1.0.4 — 2023-03-06
- 1.0.3 — 2023-03-05
- 1.0.2 — 2023-03-05
- 1.0.1 — 2023-03-05
- 1.0.0 — 2023-03-05

## README

# **@highflying/circuit-cube** - A Javascript module to interface with Circuit Cubes.

### Announcements

- v1.0.0 First release

```javascript
const { PoweredUP } = require("../src");

const poweredUP = new PoweredUP();

poweredUP.on("discover", async (hub) => {
  // Wait to discover a Hub
  console.log(`Discovered ${hub.name}!`);

  await hub.connect(); // Connect to the Hub
  console.log("Connected");

  console.log("name", await hub.getName());
  await hub.setName("GWR");
  console.log("name", await hub.getName());
  console.log("battery level", hub.batteryLevel);

  console.log("voltage", await hub.getVoltage());
  await hub.setPower([250, undefined, -250]);
  await hub.sleep(500);
  await hub.stopAll();
  await hub.sleep(500);
});

poweredUP.scan(); // Start scanning for Hubs
console.log("Scanning for Hubs...");
```

### Documentation

### Node.js Installation

Node.js v12.0+ required.

```javascript
npm install @highflying/circuit-cube --save
```

node-poweredup uses the Noble BLE library by Sandeep Mistry. On macOS everything should function out of the box. On Linux and Windows there are [certain dependencies which may need installed first](https://github.com/abandonware/noble#prerequisites).

Note: node-poweredup has been tested on macOS 11.0 and Debian/Raspbian on the Raspberry Pi 4 Model B.

### Known Issues and Limitations

- On most Unix systems, you need root permissions to access Bluetooth devices. You may want to [grant the node executable access to the Bluetooth adapter](https://github.com/abandonware/noble#running-without-rootsudo-linux-specific)

### Credits

Thanks go to Nathan Kellenicki ([@nathankellenicki](https://github.com/nathankellenicki)) for node-powered on which this code was originally based.

---
_Source: https://npm.io/package/@highflying/circuit-cube · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
