File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Logs
2+ logs
3+ * .log
4+
5+ # Runtime data
6+ pids
7+ * .pid
8+ * .seed
9+
10+ # Directory for instrumented libs generated by jscoverage/JSCover
11+ lib-cov
12+
13+ # Coverage directory used by tools like istanbul
14+ coverage
15+
16+ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+ .grunt
18+
19+ # node-waf configuration
20+ .lock-wscript
21+
22+ # Compiled binary addons (http://nodejs.org/api/addons.html)
23+ build /Release
24+
25+ # Dependency directory
26+ # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+ node_modules
28+ .idea
Original file line number Diff line number Diff line change 1+ var five = require ( 'johnny-five' ) ;
2+
3+ five . Board ( ) . on ( "ready" , function ( ) {
4+ console . log ( "Board is ready!" ) ;
5+
6+ var led = new five . Led ( 11 ) ;
7+ setInterval ( toggleLed , 500 ) ;
8+
9+ function toggleLed ( ) {
10+ led . toggle ( ) ;
11+ }
12+ } ) ;
13+
14+ console . log ( "Waiting for board to be ready..." ) ;
Original file line number Diff line number Diff line change 1+ var five = require ( 'johnny-five' ) ;
2+
3+ five . Board ( ) . on ( "ready" , function ( ) {
4+ five . Led ( 11 ) . strobe ( 500 ) ;
5+ } ) ;
Original file line number Diff line number Diff line change 1+ var five = require ( 'johnny-five' ) ;
2+
3+ five . Board ( ) . on ( "ready" , function ( ) {
4+ var led = five . Led ( 11 ) ;
5+
6+ this . repl . inject ( {
7+ led : led
8+ } ) ;
9+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " blinky" ,
3+ "version" : " 0.0.1" ,
4+ "dependencies" : {
5+ "johnny-five" : " latest"
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ var five = require ( "johnny-five" ) ;
2+ var board = new five . Board ( ) ;
3+
4+ board . on ( "ready" , function ( ) {
5+
6+ var claw = new five . Servo ( 9 ) ;
7+ var arm = five . Servo ( 10 ) ;
8+ var degrees = 10 ;
9+ var incrementer = 10 ;
10+ var last ;
11+
12+ this . loop ( 25 , function ( ) {
13+
14+ if ( degrees >= 180 || degrees === 0 ) {
15+ incrementer *= - 1 ;
16+ }
17+
18+ degrees += incrementer ;
19+
20+ if ( degrees === 180 ) {
21+ if ( ! last || last === 90 ) {
22+ last = 180 ;
23+ } else {
24+ last = 90 ;
25+ }
26+ arm . to ( last ) ;
27+ }
28+
29+ claw . to ( degrees ) ;
30+ } ) ;
31+ } ) ;
Original file line number Diff line number Diff line change 1+ var five = require ( "johnny-five" ) ;
2+
3+ five . Board ( ) . on ( "ready" , function ( ) {
4+ var pan , tilt , joystick ;
5+
6+ // Pan & tilt servos
7+ pan = new five . Servo ( 9 ) ;
8+ tilt = new five . Servo ( 10 ) ;
9+
10+ // Joystick controller
11+ joystick = new five . Joystick ( {
12+ pins : [ 'A0' , 'A1' ]
13+ } )
14+
15+ // Center all servos
16+ five . Servos . center ( ) ;
17+
18+ joystick . on ( 'change' , function ( ) {
19+ tilt . move ( Math . ceil ( 180 * this . fixed . y ) ) ;
20+ pan . move ( Math . ceil ( 180 * this . fixed . x ) ) ;
21+ } )
22+ } ) ;
Original file line number Diff line number Diff line change 1+ var five = require ( "johnny-five" ) ;
2+ var board = new five . Board ( ) ;
3+
4+ board . on ( "ready" , function ( ) {
5+ var proximity = new five . Proximity ( {
6+ controller : "LIDARLITE"
7+ } ) ;
8+
9+ //proximity.on("data", function() {
10+ // console.log("Proximity: ");
11+ // console.log(" cm : ", this.cm);
12+ // console.log(" in : ", this.in);
13+ // console.log("-----------------");
14+ //});
15+
16+ proximity . on ( "change" , function ( ) {
17+ console . log ( this . cm + "cm" ) ;
18+ } ) ;
19+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " input" ,
3+ "version" : " 0.0.1" ,
4+ "dependencies" : {
5+ "johnny-five" : " latest"
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ var five = require ( "johnny-five" ) ;
2+ var board = new five . Board ( ) ;
3+
4+ board . on ( "ready" , function ( ) {
5+ var proximity = new five . Proximity ( {
6+ controller : "HCSR04" ,
7+ pin : 7
8+ } ) ;
9+
10+ proximity . on ( "data" , function ( ) {
11+ console . log ( "Proximity: " ) ;
12+ console . log ( " cm : " , this . cm ) ;
13+ console . log ( " in : " , this . in ) ;
14+ console . log ( "-----------------" ) ;
15+ } ) ;
16+
17+ proximity . on ( "change" , function ( ) {
18+ console . log ( "The obstruction has moved." ) ;
19+ } ) ;
20+ } ) ;
You can’t perform that action at this time.
0 commit comments