Skip to content

EnotionZ/node-rc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

I know JavaScript is a terrible language to do this in, it's just a proof of concept, stfu.

Usage

#####From the command line

$: git clone git://github.com/EnotionZ/node-rc.git

#####Inside js file

var rc = require("./node-rc").init({

      pinRight: GPIO_HEADER_FOR_RIGHT_TURN,
      pinLeft: GPIO_HEADER_FOR_LEFT_TURN,
      pinBackward: GPIO_HEADER_FOR_DRIVING_BACKWARD,
      pinForward: GPIO_HEADER_FOR_DRIVING_FORWARD,

      // place code to fire when headers are ready
      ready: function() {

            // driving
            rc.drive("forward");
            rc.drive("backward");
            rc.stop();

            // steering
            rc.turn("left");
            rc.turn("right");
            rc.straight();

            // shortcuts
            rc.drive("f");    // drive forward
            rc.drive("b");    // drive backward
            rc.drive();       // stops driving
            rc.turn("l");     // turn left
            rc.turn("r");     // turn right
            rc.turn();        // straighten wheels

            // When done, unexport the headers
            rc.end(function() {
                  // Fire callback once all headers export
                  process.exit();
            });
      }
});

About

Drive your RC car using nodejs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published