This project uses DeviceScript to interact with a blues.io Notecard.
This library uses the serial-to-i2c bridge.
This library has a minimal surface and most messages have not been mapped to types. See Notecard API for a full list.
Add the library to your DeviceScript project:
npm install --save pelikhan/devicescript-note
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.
# .env.defaults
NOTE_PUID=your-product-uid
NOTE_SN=your-serial-number
- Connect the notecard to your I2C pins and power it up.
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(<NoteAddRequest>{
req: "note.add",
body: { time: millis() },
})
console.log(res)
// take a break
await delay(10000)
}
Contributions are welcome. Follow the guide.