@cloudthrottle/dcc-ex--serial-communicator
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i @cloudthrottle/dcc-ex--serial-communicator

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    16.3 kB

    Total Files

    10

    Last publish

    Collaborators

    • dcyoung-dev