npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ushiboy/picmd

v0.1.1

Published

A client library for picmd

Downloads

6

Readme

node-picmd

The node-picmd is a client library for picmd.

Overview

The node-picmd is a client library for picmd, a command handler framework with serial communication for Raspberry PI.

It abstracts the communication specification of picmd and makes it easy to use.

Example

The sample code for sending the "0x01" command and receiving the response is as follows.

const { PiCmd } = require('@ushiboy/picmd');

(async function() {
  const pic = PiCmd.connect('/dev/ttyUSB0');

  const r = await pic.request(0x01);
  console.log(r.value.toString('utf-8'));

}());

API

PiCmd class

The picmd client class.

PiCmd.connect(port: string): PiCmd

Create an instance of PiCmd by passing the serial port path.

  • parameters
    • port
      • The serial port path.
      • type: string
  • return
    • The instance of PiCmd.
    • type: PiCmd

waitReady(retry?: number): Promise<void>

Wait until there is a PING response.

  • optional parameters
    • retry
      • Number of times to repeat the PING command.
      • type: number
      • default: 20

ping(timeout?: number): Promise<void>

Send a ping command.

  • optional parameters
    • timeout
      • Timeout waiting for a ping command response.
      • type: number
      • default: 2000 ms

request(command: number, data?: Buffer, timeout?: number): Promise<CommandResponse>

Send a command and return a response.

  • parameters
    • command
      • The command to send.
      • type: number
  • optional parameters
    • data
      • The data of the command to be sent.
      • type: Buffer
    • timeout
      • Timeout waiting for a command response.
      • type: number
      • default: 60000 ms
  • return
    • The result of the execution of the command.
    • type: CommandResponse

CommandResponse type

The result of the execution of the command.

  • properties
    • status
      • The status of the command execution result.
      • type: number
    • size
      • The response data size of command execution result.
      • type: number
    • value
      • The response data of command execution result.
      • type: Buffer
    • parity
      • The parity value for checking
      • type: number

Change Log

0.1.1

Fix example code.

0.1.0

Initial release.

License

MIT