Permalink
Browse files

Render doc examples

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information...
1 parent 2b4230d commit 4b2cf076bc337022e7299f84e5d1fa1c1a69abe2 @rwaldron committed Sep 3, 2013
View
@@ -49,12 +49,12 @@ five.Board().on("ready", function() {
});
- // "read"
+ // "data"
//
// Fires continuously, every 66ms.
//
- ir.on("read", function( err, timestamp ) {
- // console.log( "read" );
+ ir.on("data", function( err, timestamp ) {
+ // console.log( "data" );
});
});
View
@@ -24,12 +24,12 @@ five.Board().on("ready", function() {
var ir = new five.IR.Reflect();
- // "read"
+ // "data"
//
// Fires continuously, every 66ms.
//
- ir.on("read", function( err, timestamp ) {
- console.log( "read" );
+ ir.on("data", function( err, timestamp ) {
+ console.log( "data" );
});
});
@@ -53,7 +53,7 @@ board.on("ready", function() {
servo.move( 90 );
// As the heading changes, log heading value
- mag.on("read", function() {
+ mag.on("data", function() {
var heading = Math.floor( this.heading );
if ( heading > 345 || heading < 15 ) {
View
@@ -463,7 +463,7 @@ Navigator.prototype.pivot = function( which, time ) {
// distance reading has changed since the previous reading
//
// TODO: Avoid false positives?
- ping.on("read", function( err ) {
+ ping.on("data", function( err ) {
var release = 750,
distance = Math.abs(this.inches),
isReverse = false,
@@ -421,7 +421,7 @@ board.on("ready", function() {
// distance reading has changed since the previous reading
//
// TODO: Avoid false positives?
- ping.on("read", function( err ) {
+ ping.on("data", function( err ) {
var release = 750,
distance = Math.abs(this.inches),
isReverse = false,
View
@@ -27,8 +27,8 @@ board.on("ready", function() {
pot: photoresistor
});
- // "read" get the current reading from the photoresistor
- photoresistor.on("read", function() {
+ // "data" get the current reading from the photoresistor
+ photoresistor.on("data", function() {
console.log( this.value );
});
});
View
@@ -37,9 +37,9 @@ board.on("ready", function() {
// Ping Event API
- // "read" get the current reading from the ping
- ping.on("read", function( err, value ) {
- console.log( "read", value );
+ // "data" get the current reading from the ping
+ ping.on("data", function( err, value ) {
+ console.log( "data", value );
});
ping.on("change", function( err, value ) {
View
@@ -27,8 +27,8 @@ board.on("ready", function() {
pot: potentiometer
});
- // "read" get the current reading from the potentiometer
- potentiometer.on("read", function() {
+ // "data" get the current reading from the potentiometer
+ potentiometer.on("data", function() {
console.log( this.value, this.raw );
});
});
View
@@ -118,7 +118,7 @@ board.on("ready", function() {
soi = socket;
- ping.on("read", function() {
+ ping.on("data", function() {
if ( last !== degrees ) {
io.sockets.emit( "ping", {
View
@@ -22,7 +22,7 @@ board.on("ready", function() {
servo = new five.Servo(10);
- fsr.scale([ 0, 180 ]).on("read", function() {
+ fsr.scale([ 0, 180 ]).on("data", function() {
servo.move( this.value );
View
@@ -21,7 +21,7 @@ var five = require("johnny-five"),
led = new five.Led(9);
// Scale the sensor's value to the LED's brightness range
- fsr.scale([ 0, 255 ]).on("read", function() {
+ fsr.scale([ 0, 255 ]).on("data", function() {
// set the led's brightness based on force
// applied to force sensitive resistor
@@ -22,7 +22,7 @@ board.on("ready", function() {
})
};
- ir.receive.scale([ 0, 100 ]).on("read", function() {
+ ir.receive.scale([ 0, 100 ]).on("data", function() {
// console.log( this.value );
@@ -12,7 +12,7 @@ var five = require("johnny-five");
five.Board().on("ready", function(){
var sensor = new five.Sensor("A0");
- sensor.on("read", function(){
+ sensor.on("data", function(){
var voltage = this.value * 0.004882814;
var celsius = (voltage - 0.5) * 100;
var fahrenheit = celsius * (9/5) + 32;
View
@@ -41,11 +41,11 @@ board.on("ready", function() {
// Sensor Event API
- // "read"
+ // "data"
//
// Fires when the pin is read for a value
//
- sensor.scale([ 0, 100 ]).on("read", function() {
+ sensor.scale([ 0, 100 ]).on("data", function() {
console.log( this.value, this.raw );
});
View
@@ -37,17 +37,17 @@ board.on("ready", function() {
// Sonar Event API
//
- // "read" fired continuously
+ // "data" fired continuously
//
- sonar.on("read", function() {
+ sonar.on("data", function() {
/*
this.voltage - raw voltage reading
this.inches - calculated distance, inches
this.cm - calculated distance, centimeters
*/
- console.log( "read", "Object is " + this.inches + "inches away" );
+ console.log( "data", "Object is " + this.inches + "inches away" );
});
//
@@ -10,7 +10,7 @@ node eg/tinkerkit-linear-pot.js
var five = require("johnny-five");
new five.Board().on("ready", function() {
- new five.Sensor("I0").scale(0, 100).on("read", function() {
+ new five.Sensor("I0").scale(0, 255).on("data", function() {
console.log( Math.round(this.value) );
});
});
@@ -27,6 +27,7 @@ new five.Board().on("ready", function() {
- [TinkerKit Linear Potentiometer](http://www.tinkerkit.com/linear-pot/)
+- [TinkerKit Led](http://www.tinkerkit.com/led/)
- [TinkerKit Shield](http://www.tinkerkit.com/shield/)

0 comments on commit 4b2cf07

Please sign in to comment.