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-communicatorimport {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.gitGo to the project directory
cd dcc-ex--serial-communicatorInstall 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 installInstall dependencies
npm installRun the test suite
npm testHere are some related projects