Skip to content

Commit

Permalink
Remove bogus null arguments from emitters. Fixes gh-561
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Jan 7, 2015
1 parent 4a0e1e2 commit 3e0ebd4
Show file tree
Hide file tree
Showing 48 changed files with 222 additions and 306 deletions.
2 changes: 1 addition & 1 deletion eg/accelerometer-pan-tilt.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ board.on("ready", function() {
// Center all servos
(five.Servos()).center();

accel.on("acceleration", function(err, timestamp) {
accel.on("acceleration", function() {
// console.log( "acceleration", this.axis );

tilt.to(Math.abs(Math.ceil(170 * this.pitch.toFixed(2)) - 180));
Expand Down
6 changes: 3 additions & 3 deletions eg/classic-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ board.on("ready", function() {
// Fired when the joystick detects a change in
// axis position.
//
nunchuk.joystick.left.on("change", function(err, event) {
nunchuk.joystick.left.on("change", function(event) {
console.log(
"Left joystick " + event.axis,
event.target[event.axis],
event.axis, event.direction
);
});

nunchuk.joystick.right.on("change", function(err, event) {
nunchuk.joystick.right.on("change", function(event) {
console.log(
"Right joystick " + event.axis,
event.target[event.axis],
Expand Down Expand Up @@ -78,7 +78,7 @@ board.on("ready", function() {

["down", "up", "hold"].forEach(function(type) {

nunchuk.on(type, function(err, event) {
nunchuk.on(type, function(event) {
console.log(
event.target.which + " is " + type,

Expand Down
4 changes: 2 additions & 2 deletions eg/gripper.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ var five = require("../lib/johnny-five.js"),
// g.*() from REPL
//
//
motion.on("motionstart", function(err, ts) {
motion.on("motionstart", function() {
chop();
});

// "motionstart" events are fired following a "motionstart event
// when no movement has occurred in X ms
motion.on("motionend", function(err, ts) {
motion.on("motionend", function() {
if (repeater) {
repeater.stop();
repeater = null;
Expand Down
12 changes: 6 additions & 6 deletions eg/ir-motion.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ board.on("ready", function() {
// Pir Event API

// "calibrated" occurs once, at the beginning of a session,
motion.on("calibrated", function(err, ts) {
console.log("calibrated", ts);
motion.on("calibrated", function() {
console.log("calibrated", Date.now());
});

// "motionstart" events are fired when the "calibrated"
// proximal area is disrupted, generally by some form of movement
motion.on("motionstart", function(err, ts) {
console.log("motionstart", ts);
motion.on("motionstart", function() {
console.log("motionstart", Date.now());
});

// "motionend" events are fired following a "motionstart" event
// when no movement has occurred in X ms
motion.on("motionend", function(err, ts) {
console.log("motionend", ts);
motion.on("motionend", function() {
console.log("motionend", Date.now());
});
});
2 changes: 1 addition & 1 deletion eg/ir-proximity.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ five.Board().on("ready", function() {
//
// Fires continuously, every 66ms.
//
ir.on("data", function(err, timestamp) {
ir.on("data", function() {
// console.log( "data" );
});
});
4 changes: 2 additions & 2 deletions eg/ir-reflect-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ five.Board().on("ready", function() {

// calibrate for two seconds
eyes.calibrateUntil(function() { return !calibrating; });
setTimeout(function() { calibrating = false; }, 2000);
setTimeout(function() { calibrating = false; }, 2000);

eyes.enable();

// "line"
//
// Fires continuously once calibrated
//
eyes.on("line", function(err, line) {
eyes.on("line", function(line) {
console.log("line: ", line);
});
});
Expand Down
2 changes: 1 addition & 1 deletion eg/ir-reflect.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ five.Board().on("ready", function() {
//
// Fires continuously, every 66ms.
//
ir.on("data", function(err, timestamp) {
ir.on("data", function() {
console.log("data");
});
});
2 changes: 1 addition & 1 deletion eg/joystick-motor-led.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ board.on("ready", function() {

// Pushing the joystick to up position should start the motor,
// releasing it will turn the motor off.
joystick.on("axismove", function(err, timestamp) {
joystick.on("axismove", function() {

if (!motor.isOn && this.axis.y > 0.51) {
motor.start();
Expand Down
2 changes: 1 addition & 1 deletion eg/joystick.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ board.on("ready", function() {

// Joystick Event API

joystick.on("axismove", function(err, timestamp) {
joystick.on("axismove", function() {

// Axis data is available on:
// this.axis
Expand Down
24 changes: 12 additions & 12 deletions eg/motor-3-pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ board.on("ready", function() {
pwm: 9
dir: 8
cdir: 11
Motor B
pwm: 10
dir: 12
Expand All @@ -20,7 +20,7 @@ board.on("ready", function() {
pwm: 6
dir: 5
cdir: 7
Motor B
pwm: 4
dir: 3
Expand All @@ -44,29 +44,29 @@ board.on("ready", function() {
motor: motor
});

motor.on("start", function(err, timestamp) {
console.log("start", timestamp);
motor.on("start", function() {
console.log("start", Date.now());
});

motor.on("stop", function(err, timestamp) {
console.log("automated stop on timer", timestamp);
motor.on("stop", function() {
console.log("automated stop on timer", Date.now());
});

motor.on("brake", function(err, timestamp) {
console.log("automated brake on timer", timestamp);
motor.on("brake", function() {
console.log("automated brake on timer", Date.now());
});

motor.on("forward", function(err, timestamp) {
console.log("forward", timestamp);
motor.on("forward", function() {
console.log("forward", Date.now());

// demonstrate switching to reverse after 5 seconds
board.wait(5000, function() {
motor.reverse(255);
});
});

motor.on("reverse", function(err, timestamp) {
console.log("reverse", timestamp);
motor.on("reverse", function() {
console.log("reverse", Date.now());

// demonstrate braking after 5 seconds
board.wait(5000, function() {
Expand Down
8 changes: 4 additions & 4 deletions eg/motor-PCA9685.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ board.on("ready", function() {
// Motor Event API

// "start" events fire when the motor is started.
motor.on("start", function(err, timestamp) {
console.log("start", timestamp);
motor.on("start", function() {
console.log("start", Date.now());

// Demonstrate motor stop in 2 seconds
board.wait(2000, function() {
Expand All @@ -36,8 +36,8 @@ board.on("ready", function() {
});

// "stop" events fire when the motor is started.
motor.on("stop", function(err, timestamp) {
console.log("stop", timestamp);
motor.on("stop", function() {
console.log("stop", Date.now());
});

// Motor API
Expand Down
20 changes: 10 additions & 10 deletions eg/motor-brake.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,29 @@ board.on("ready", function() {
motor: motor
});

motor.on("start", function(err, timestamp) {
console.log("start", timestamp);
motor.on("start", function() {
console.log("start", Date.now());
});

motor.on("stop", function(err, timestamp) {
console.log("automated stop on timer", timestamp);
motor.on("stop", function() {
console.log("automated stop on timer", Date.now());
});

motor.on("brake", function(err, timestamp) {
console.log("automated brake on timer", timestamp);
motor.on("brake", function() {
console.log("automated brake on timer", Date.now());
});

motor.on("forward", function(err, timestamp) {
console.log("forward", timestamp);
motor.on("forward", function() {
console.log("forward", Date.now());

// demonstrate switching to reverse after 5 seconds
board.wait(5000, function() {
motor.reverse(150);
});
});

motor.on("reverse", function(err, timestamp) {
console.log("reverse", timestamp);
motor.on("reverse", function() {
console.log("reverse", Date.now());

// demonstrate stopping after 5 seconds
board.wait(5000, function() {
Expand Down
20 changes: 10 additions & 10 deletions eg/motor-current.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,29 @@ board.on("ready", function() {
console.log("Motor A: " + this.value.toFixed(2) + "mA");
});

motor.on("start", function(err, timestamp) {
console.log("start", timestamp);
motor.on("start", function() {
console.log("start", Date.now());
});

motor.on("stop", function(err, timestamp) {
console.log("automated stop on timer", timestamp);
motor.on("stop", function() {
console.log("automated stop on timer", Date.now());
});

motor.on("brake", function(err, timestamp) {
console.log("automated brake on timer", timestamp);
motor.on("brake", function() {
console.log("automated brake on timer", Date.now());
});

motor.on("forward", function(err, timestamp) {
console.log("forward", timestamp);
motor.on("forward", function() {
console.log("forward", Date.now());

// demonstrate switching to reverse after 5 seconds
board.wait(5000, function() {
motor.reverse(150);
});
});

motor.on("reverse", function(err, timestamp) {
console.log("reverse", timestamp);
motor.on("reverse", function() {
console.log("reverse", Date.now());

// demonstrate stopping after 5 seconds
board.wait(5000, function() {
Expand Down
16 changes: 8 additions & 8 deletions eg/motor-directional.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,25 @@ board.on("ready", function() {
motor: motor
});

motor.on("start", function(err, timestamp) {
console.log("start", timestamp);
motor.on("start", function() {
console.log("start", Date.now());
});

motor.on("stop", function(err, timestamp) {
console.log("automated stop on timer", timestamp);
motor.on("stop", function() {
console.log("automated stop on timer", Date.now());
});

motor.on("forward", function(err, timestamp) {
console.log("forward", timestamp);
motor.on("forward", function() {
console.log("forward", Date.now());

// demonstrate switching to reverse after 5 seconds
board.wait(5000, function() {
motor.reverse(50);
});
});

motor.on("reverse", function(err, timestamp) {
console.log("reverse", timestamp);
motor.on("reverse", function() {
console.log("reverse", Date.now());

// demonstrate stopping after 5 seconds
board.wait(5000, function() {
Expand Down
16 changes: 8 additions & 8 deletions eg/motor-hbridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ board.on("ready", function() {
motor: motor
});

motor.on("start", function(err, timestamp) {
console.log("start", timestamp);
motor.on("start", function() {
console.log("start", Date.now());
});

motor.on("stop", function(err, timestamp) {
console.log("automated stop on timer", timestamp);
motor.on("stop", function() {
console.log("automated stop on timer", Date.now());
});

motor.on("forward", function(err, timestamp) {
console.log("forward", timestamp);
motor.on("forward", function() {
console.log("forward", Date.now());

// demonstrate switching to reverse after 5 seconds
board.wait(5000, function() {
motor.reverse(50);
});
});

motor.on("reverse", function(err, timestamp) {
console.log("reverse", timestamp);
motor.on("reverse", function() {
console.log("reverse", Date.now());

// demonstrate stopping after 5 seconds
board.wait(5000, function() {
Expand Down
8 changes: 4 additions & 4 deletions eg/motor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ board.on("ready", function() {
// Motor Event API

// "start" events fire when the motor is started.
motor.on("start", function(err, timestamp) {
console.log("start", timestamp);
motor.on("start", function() {
console.log("start", Date.now());

// Demonstrate motor stop in 2 seconds
board.wait(2000, function() {
Expand All @@ -29,8 +29,8 @@ board.on("ready", function() {
});

// "stop" events fire when the motor is started.
motor.on("stop", function(err, timestamp) {
console.log("stop", timestamp);
motor.on("stop", function() {
console.log("stop", Date.now());
});

// Motor API
Expand Down
2 changes: 1 addition & 1 deletion eg/navigator-original.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ board.on("ready", function() {
// [2] Sonar "change" events are emitted when the value of a
// distance reading has changed since the previous reading
//
sonar.on("change", function(err) {
sonar.on("change", function() {
var turnTo;

// Detect collideAt
Expand Down
2 changes: 1 addition & 1 deletion eg/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ Navigator.prototype.pivot = function(which, time) {
// distance reading has changed since the previous reading
//
// TODO: Avoid false positives?
ping.on("data", function(err) {
ping.on("data", function() {
var release = 750,
distance = Math.abs(this.inches),
isReverse = false,
Expand Down
Loading

0 comments on commit 3e0ebd4

Please sign in to comment.