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

tinker-io

v2.0.0

Published

simple tinker based IO class for the particle cloud

Downloads

5

Readme

Tinker-io

Tinker-io is a Firmata-compatibility IO class for writing node programs that interact with Particle devices (formerly Spark). Tinker-io was built at IcedDev

Caveat

This is a very simplified IO class. It is meant to be used over the particle cloud using the default Tinker sketch that ships on the device.

For a full-featured IO class you should be using particle-io

Getting Started

In order to use the tinker-io library, you will need to use the default Tinker sketch.

The host computer (where you're running your Node.js or Web application) and the Particle do NOT have to be on the same local network.

Blink an Led

The "Hello World" of microcontroller programming:

var TinkerIO = require("tinker-io");
var board = new TinkerIO({
  token: YOUR_PARTICLE_TOKEN,
//  optional - you can use your username/password instead of token  
//  username: YOUR_PARTICLE_USERNAME_EMAIL,
//  password: YOUR_PARTICLE_PASSWORD,
  deviceName: YOUR_DEVICE_NAME
});

board.on("ready", function() {
  console.log("CONNECTED");
  this.pinMode("D7", this.MODES.OUTPUT);

  var byte = 0;

  // This will "blink" the on board led
  setInterval(function() {
    this.digitalWrite("D7", (byte ^= 1));
  }.bind(this), 500);

  this.pinMode("A1", five.Pin.ANALOG);
  this.analogRead("A1", function(voltage) {
    console.log("analog read", voltage);
  });

  this.pinMode("D1", five.Pin.INPUT);
  this.digitalRead("D1", function(value) {
    console.log('digital read', value);
  });
});

Johnny-Five IO Plugin

Tinker-IO can be used as an IO Plugin for Johnny-Five:

var five = require("johnny-five");
var TinkerIO = require("tinker-io");
var board = new five.Board({
  io: new TinkerIO({
    token: YOUR_PARTICLE_TOKEN,
    deviceId: YOUR_PARTICLE_DEVICE_ID
  })
});

board.on("ready", function() {
  var led = new five.Led("D7");
  led.blink();

  var sensor = new five.Sensor("A0");

  // When the sensor value changes, log the value
  sensor.on("change", function() {
    console.log(this.value);
  });

});