Skip to content

Commit

Permalink
Rebuild all example program markdown files
Browse files Browse the repository at this point in the history
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Jul 2, 2012
1 parent 462ec64 commit 6b5ab5b
Show file tree
Hide file tree
Showing 56 changed files with 5,957 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -97,19 +97,19 @@ board.on("ready", function() {
- [Led Pulse](https://github.com/rwldrn/johnny-five/blob/master/docs/led-pulse.md)
- [Led Rgb](https://github.com/rwldrn/johnny-five/blob/master/docs/led-rgb.md)
- [Led Strobe](https://github.com/rwldrn/johnny-five/blob/master/docs/led-strobe.md)
- [Magnetometer Log](https://github.com/rwldrn/johnny-five/blob/master/docs/magnetometer-log.md)
- [Magnetometer North](https://github.com/rwldrn/johnny-five/blob/master/docs/magnetometer-north.md)
- [Magnetometer Servo](https://github.com/rwldrn/johnny-five/blob/master/docs/magnetometer-servo.md)
- [Magnetometer](https://github.com/rwldrn/johnny-five/blob/master/docs/magnetometer.md)
- [Motor](https://github.com/rwldrn/johnny-five/blob/master/docs/motor.md)
- [Navigator Joystick](https://github.com/rwldrn/johnny-five/blob/master/docs/navigator-joystick.md)
- [Navigator Original](https://github.com/rwldrn/johnny-five/blob/master/docs/navigator-original.md)
- [Navigator](https://github.com/rwldrn/johnny-five/blob/master/docs/navigator.md)
- [Piezo](https://github.com/rwldrn/johnny-five/blob/master/docs/piezo.md)
- [Ping Radar](https://github.com/rwldrn/johnny-five/blob/master/docs/ping-radar.md)
- [Ping](https://github.com/rwldrn/johnny-five/blob/master/docs/ping.md)
- [Pir](https://github.com/rwldrn/johnny-five/blob/master/docs/pir.md)
- [Potentiometer](https://github.com/rwldrn/johnny-five/blob/master/docs/potentiometer.md)
- [Proximity](https://github.com/rwldrn/johnny-five/blob/master/docs/proximity.md)
- [Radar Client](https://github.com/rwldrn/johnny-five/blob/master/docs/radar-client.md)
- [Radar](https://github.com/rwldrn/johnny-five/blob/master/docs/radar.md)
- [Repl](https://github.com/rwldrn/johnny-five/blob/master/docs/repl.md)
- [Sensor Fsr Servo](https://github.com/rwldrn/johnny-five/blob/master/docs/sensor-fsr-servo.md)
Expand Down
80 changes: 80 additions & 0 deletions docs/accelerometer-pan-tilt.md
@@ -0,0 +1,80 @@
# Accelerometer Pan Tilt

Run with:
```bash
node eg/accelerometer-pan-tilt.js
```


```javascript
var five = require("johnny-five"),
board;

board = new five.Board();

board.on("ready", function() {

var range, pan, tilt, accel;

range = [ 0, 170 ];

// Servo to control panning
pan = new five.Servo({
pin: 9,
range: range
});

// Servo to control tilt
tilt = new five.Servo({
pin: 10,
range: range
});

// Accelerometer to control pan/tilt
accel = new five.Accelerometer({
pins: [ "A3", "A4", "A5" ],
freq: 250
});

// Center all servos
(five.Servos()).center();

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

tilt.move( Math.abs( Math.ceil(170 * this.pitch.toFixed(2)) - 180 ) );
pan.move( Math.ceil(170 * this.roll.toFixed(2)) );

// TODO: Math.abs(v - 180) as inversion function ?
});
});

```

## Breadboard




## Documentation

_(Nothing yet)_









## Contributing
All contributions must adhere to the the [Idiomatic.js Style Guide](https://github.com/rwldrn/idiomatic.js),
by maintaining the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/cowboy/grunt).

## Release History
_(Nothing yet)_

## License
Copyright (c) 2012 Rick Waldron <waldron.rick@gmail.com>
Licensed under the MIT license.
84 changes: 84 additions & 0 deletions docs/accelerometer.md
@@ -0,0 +1,84 @@
# Accelerometer

Run with:
```bash
node eg/accelerometer.js
```


```javascript
var five = require("johnny-five"),
board, accel;

board = new five.Board();

board.on("ready", function() {

// Create a new `Accelerometer` hardware instance.
//
// five.Accelerometer([ x, y[, z] ]);
//
// five.Accelerometer({
// pins: [ x, y[, z] ]
// freq: ms
// });
//

accel = new five.Accelerometer({
pins: [ "A3", "A4", "A5" ],
freq: 100
});

// Accelerometer Event API

// "acceleration"
//
// Fires once every N ms, equal to value of freg
// Defaults to 500ms
//
accel.on("acceleration", function( err, timestamp ) {

console.log( "acceleration", this.pitch, this.roll );
});

// "axischange"
//
// Fires only when X, Y or Z has changed
//
accel.on("axischange", function( err, timestamp ) {

console.log( "axischange", this.raw );
});
});

```

## Breadboard

<img src="https://raw.github.com/rwldrn/johnny-five/master/docs/breadboard/accelerometer.png">

[accelerometer.fzz](https://github.com/rwldrn/johnny-five/blob/master/docs/breadboard/accelerometer.fzz)


## Documentation

_(Nothing yet)_









## Contributing
All contributions must adhere to the the [Idiomatic.js Style Guide](https://github.com/rwldrn/idiomatic.js),
by maintaining the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/cowboy/grunt).

## Release History
_(Nothing yet)_

## License
Copyright (c) 2012 Rick Waldron <waldron.rick@gmail.com>
Licensed under the MIT license.
63 changes: 63 additions & 0 deletions docs/board-multi.md
@@ -0,0 +1,63 @@
# Board Multi

Run with:
```bash
node eg/board-multi.js
```


```javascript
var five = require("johnny-five"),
boards;

boards = [
new five.Board({ id: "a" }),
new five.Board({ id: "b" })
];

// Add ready event handlers to both boards.
boards.forEach(function( board ) {
board.on("ready", function() {
var val = 0;

console.log( "ready!!!!!" );

// Set pin 13 to OUTPUT mode
this.pinMode( 13, 1 );

// Create a loop to "flash/blink/strobe" an led
this.loop( 50, function() {
this.digitalWrite( 13, (val = val ? 0 : 1) );
});
});
});

```

## Breadboard




## Documentation

_(Nothing yet)_









## Contributing
All contributions must adhere to the the [Idiomatic.js Style Guide](https://github.com/rwldrn/idiomatic.js),
by maintaining the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/cowboy/grunt).

## Release History
_(Nothing yet)_

## License
Copyright (c) 2012 Rick Waldron <waldron.rick@gmail.com>
Licensed under the MIT license.
72 changes: 72 additions & 0 deletions docs/board.md
@@ -0,0 +1,72 @@
# Board

Run with:
```bash
node eg/board.js
```


```javascript
var five = require("johnny-five"),
board;

board = new five.Board();

// The board's pins will not be accessible until
// the board has reported that it is ready
board.on("ready", function() {
var val = 0;

// Set pin 13 to OUTPUT mode
this.pinMode( 13, 1 );

// Mode Table
// INPUT: 0
// OUTPUT: 1
// ANALOG: 2
// PWM: 3
// SERVO: 4

// Create a loop to "flash/blink/strobe" an led
this.loop( 50, function() {

this.digitalWrite( 13, (val = val ? 0 : 1) );

});
});


// Schematic
// http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_bb.png

```

## Breadboard

<img src="https://raw.github.com/rwldrn/johnny-five/master/docs/breadboard/board.png">

[board.fzz](https://github.com/rwldrn/johnny-five/blob/master/docs/breadboard/board.fzz)


## Documentation

_(Nothing yet)_









## Contributing
All contributions must adhere to the the [Idiomatic.js Style Guide](https://github.com/rwldrn/idiomatic.js),
by maintaining the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/cowboy/grunt).

## Release History
_(Nothing yet)_

## License
Copyright (c) 2012 Rick Waldron <waldron.rick@gmail.com>
Licensed under the MIT license.

0 comments on commit 6b5ab5b

Please sign in to comment.