https://github.com/pelikhan/devicescript-note
A DeviceScript library to use blues.io notecard
https://github.com/pelikhan/devicescript-note
devicescript iot typescript
Last synced: about 1 year ago
JSON representation
A DeviceScript library to use blues.io notecard
- Host: GitHub
- URL: https://github.com/pelikhan/devicescript-note
- Owner: pelikhan
- Created: 2023-06-08T21:41:14.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-10T04:48:59.000Z (almost 3 years ago)
- Last Synced: 2025-02-02T04:45:24.914Z (about 1 year ago)
- Topics: devicescript, iot, typescript
- Language: TypeScript
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# Note client for DeviceScript
This project uses [DeviceScript](https://microsoft.github.io/devicescript/)
to interact with a [blues.io Notecard](https://blues.io/products/notecard/).
This library uses the [serial-to-i2c bridge](https://dev.blues.io/guides-and-tutorials/notecard-guides/serial-over-i2c-protocol/).
> This library has a minimal surface and most messages have not been mapped to types. See [Notecard API](https://dev.blues.io/api-reference/notecard-api/introduction/) for a full list.
## Setup
Add the library to your DeviceScript project:
```bash
npm install --save pelikhan/devicescript-note
```
## Configuration
Add the notehub product UID into your settings.
By default, DeviceScript will use the deviceid as a serial number; but you can override this setting.
```yaml
# .env.defaults
NOTE_PUID=your-product-uid
NOTE_SN=your-serial-number
```
## Usage
- Connect the notecard to your I2C pins and power it up.
```ts
import { delay, millis } from "@devicescript/core"
import { init, request, NoteAddRequest } from "devicescript-note"
// configure product UID and serial number
await init()
while (true) {
// send node.add request
const res = await request({
req: "note.add",
body: { time: millis() },
})
console.log(res)
// take a break
await delay(10000)
}
```
## Contributing
Contributions are welcome. [Follow the guide](./CONTRIBUTING.md).