303a3b24b9 | ||
---|---|---|
.github/workflows | ||
src | ||
utils | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
.npmignore | ||
.releaserc.json | ||
CODE_OF_CONDUCT.md | ||
LICENSE | ||
README.md | ||
SECURITY.md | ||
SUPPORT.md | ||
package.json | ||
rollup.config.editor.js | ||
showcase.png | ||
tsconfig.json | ||
tsconfig.runtime.json | ||
tsconfig.runtime.watch.json | ||
yarn.lock |
README.md
Node-RED Jacdac Node
Node-RED nodes to talk to Jacdac.
Jacdac is a bus-based plug-and-play hardware and software stack for microcontrollers and their peripherals. Jacdac is primarily designed for “modular electronics” scenarios that support rapid prototyping, creative exploration, making and learning through physical computing. Jacdac is designed to be cheap, flexible and extensible.
The nodes connect to a Jacdac bus via a USB and allow to listen for events or sensor readings.
Install
Use Palette manager in node-red or run the following command in your Node-RED user directory - typically ~/.node-red
npm install node-red-contrib-jacdac
!!Requirements!!
If your board uses WebUSB to connect to the host computer, you will need node-usb which has specific installation requirements. If your node-red process crashes with
LIBUSB_ERROR_NOT_SUPPORTED
, your USB setup is not right.
Jacdac firmware
You will need to connect a device with Jacdac firmware and USB port. You can learn more about compatible hardware at https://aka.ms/jacdac.
If you have a micro:bit V2 at hand, you can convert it into a Jacdac device by dropping custom firmware.
- go to https://makecode.microbit.org/
- create a new project
- click on the project settings,
Extensions
- search for https://github.com/microsoft/pxt-jacdac/devices/microbit and import it
- use the blocks under
Servers
to start which sensor you want - download to your micro:bit V2
- enjoy data!
Nodes
jacdac-event
This node listens for Jacdac events and send them in the payload. You can browse the services specification catalog to discover which events are available.
jacdac-report
This node reads Jacdac registers and send them in the payload. You can browse the services specification catalog to discover which registers are avilable are available.
By default, the node looks for sensor reading, value and intensity registers. But you can override this behavior by customizing the register filters by name or code.
jacdac-command
This node sends Jacdac commands to services. The results of command can be inferred from the content of the registers.
You can browse the services specification catalog to discover which commands are available and how their payload should be formatted. The payload can either be a number, string or boolean for simple t ypes. Or an array or JSON object for complex requests.
Developer section
Adding Nodes
You can quickly scaffold a new node and add it to the node set. Use the following command to create my-new-node-type
node:
yarn add-node my-new-node-type
The node generator is based on mustache templates. At the moment there are three templates available:
blank
(used by default) - basic node for Node-RED >=1.0blank-0
- node with a backward compatibility for running on Node-RED <1.0config
- configuration node
To generate a node using a template, specify it as the third argument:
yarn add-node my-new-node-type blank
or
yarn add-node my-new-node-config config
Developing Nodes
Build & Test in Watch mode:
yarn dev
Building Node Set
Create a production build:
yarn build
Local debugging
Local node debugging instructions at https://nodered.org/docs/creating-nodes/first-node#:~:text=To%20test%20a%20node%20module%20locally%20the%20npm,~%2F.node-red%2C%20run%3A%20npm%20install%20%3Clocation%20of%20node%20module%3E.
Acknoledgments
This repo was built using the node-red TypeScript starter.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.