# jcode-ble

> jcode web bluetooth lib

Latest version **0.0.1** (published 2022-11-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install jcode-ble
pnpm add jcode-ble
yarn add jcode-ble
bun add jcode-ble
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2022-11-24 |
| First published | 2022-11-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 88.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | akira-cn |
| Maintainers | spritejs |

## Links

- npm: https://www.npmjs.com/package/jcode-ble
- npm.io page: https://npm.io/package/jcode-ble

## Dependencies (5)

- [cors](https://npm.io/package/cors.md) ^2.8.5
- [express](https://npm.io/package/express.md) ^4.18.2
- [body-parser](https://npm.io/package/body-parser.md) ^1.20.1
- [@ctrl/tinycolor](https://npm.io/package/@ctrl/tinycolor.md) ^3.4.1
- [node-bluetooth-serial-port](https://npm.io/package/node-bluetooth-serial-port.md) ^2.2.7

## Recent versions

- 0.0.1 (latest) — 2022-11-24

## README

# Jcode-Bluetooth

用[码上掘金](https://code.juejin.cn/)操作蓝牙智能设备。

## 已支持设备

-   [x] [Mipow-Playbulb-LED](https://www.aliexpress.com/item/1005003339962930.html) | **GATT ✔︎** | **SPP x**
-   [x] [Pixoo 16x16](https://divoom.com/products/divoom-pixoo) | **GATT x** | **SPP ✔︎**
-   [x] [Pixoo-Max](https://divoom.com/products/divoom-pixoo-max) | **GATT x** | **SPP ✔︎**

逐步添加中...

## 使用方法

### 控制Playbulb智能LED

```js
import {Playbulb} from './jcode-ble.js';
const device = new Playbulb();
const button = document.querySelector('button');
function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}
button.addEventListener('click', async () => {
  await device.connect();
  let hue = 0;
  while (true) {
    await device.setColor(`hsl(${hue}, 100%, 50%)`);
    hue = (hue + 1) % 360;
    await sleep(100);
  }
});
```

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