DCC++EX Serial Communicator Library
A Javascript library to communicate with the DCC++ EX Command station.
This package relies on the Serial API which has some limitations.
Usage/Examples
Quick Start
<button>Connect</button>
<script type="module">
import * as DCCCommunicator from 'https://cdn.skypack.dev/@cloudthrottle/dcc-ex--serial-communicator';
const readHandler = (message) => {
console.log(message)
}
document.addEventListener("click", () => {
DCCCommunicator.createSerialConnection({readHandler})
})
</script>
NPM Package
Install with npm
npm install @cloudthrottle/dcc-ex--serial-communicator
import {createSerialConnection} from "@cloudthrottle/dcc-ex--serial-communicator";
const readHandler = (message) => {
console.log(message)
}
// Must be triggered by a User action like a button click
createSerialConnection({readHandler})
Documentation
Developing
Clone the project
git clone https://github.com/cloudthrottle/dcc-ex--serial-communicator.git
Go to the project directory
cd dcc-ex--serial-communicator
Install environment. This project requires Node v16.8 or above. If node is already installed this step can be skipped.
asdf
is recommended due to it's simplicity
asdf install
Install dependencies
npm install
Run the test suite
npm test
Related
Here are some related projects