New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-wpilib-ws

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-wpilib-ws

WebSocket client/server interfacing with WPILib

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

node-wpilib-ws: Node.js WPILib WebSocket protocol library

node-wpilib-ws provides both client and server implementations of the WPILib WebSocket protocol, which allows interaction with WPILib-based robot code.

Installation

npm install node-wpilib-ws

Usage Examples

The src/apps folder has very simple examples of a client and server.

Additionally, the wpilib-ws-robot package shows a concrete example of how to use the client and server classes.

The Client and Server implementations are event based, and will fire off appropriate events whenever certain classes of messages arrive over the websocket.

Listening for a DIO event

const wss = new WPILibWebSocketServer(); // This can also be a WPILibWebSocketClient
wss.start(); // Start the server (or connect to a host in the case of the client)

wss.on("dioEvent", (channel: number, payload: WPILibWSMessages.DIOPayload) => {
    // Channel refers to the DIO channel number
    // payload contains a subset of the DIOPayload message
});

Writing a PWM value

const wss = new WPILibWebSocketServer(); // This can also be a WPILibWebSocketClient
wss.start(); // Start the server (or connect to a host in the case of the client)

wss.pwmUpdateToWpilib(0, {
    "<>value": 128
});

FAQs

Package last updated on 15 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts