A Javascript library to communicate with the DCC++ EX Command station.
This package relies on the Serial API which has some limitations.
<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>
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})
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
Here are some related projects