Scott Penrose

JohnnyFive Fake

Scott is an expert software developer with over 30 years experience, specialising in education, automation and remote data.

Johnny Five Fake Modules

TODO - fake.js

#!JavaScript
var util = require('util'),
  BoardIO = require('board-io');

MyIO = function(path, callback) {
  // call super constructor
  BoardIO.call(this);

  // .. configure pins
	this._pins.push({
		name: "foo",
		supportedModes: [],
		mode: 1,
		value: 0,
		report: 1,
		analogChannel: 127
	});

  // wait for an async method or use proccess.nextTick to
  // signal events
  process.nextTick(function() {
    // connect to hardware and emit "connect" event
    this.emit("connect");

    // all done, emit ready event
    this.emit("ready");

    // finally call the passed callback
	if (callback)
		callback();
  }.bind(this));
}
util.inherits(MyIO, BoardIO);

  • Arduino
  • Javascript
  • Edison
  • RaspberryPi