Skip to content

zbettenbuk/codiejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codiejs

Disclaimer: This library is implemented to work with a specific version of the codie robots, that don't use the routing parameter. If you have a robot that doesn't work with this, feel free to submit an issue on GitHub. I'll contact you for further details and we'll try to add support for that as well. Let's make it a true community project!

A Node.js module to control a Codie robot. This module was written originally for a codie-server component that allows a Codie to be controlled remotely or use them in apps like Skratch(X), but generalized enough to use it in other custom apps.

License

This module is licensed under AGPL, please take this into consideration when re-using.

Usage

Requirements

This module uses noble to communicate over bluetooth, and noble has some heavy requirements. Setting up on a mac is fairly easy, you only need xcode, and node-gyp, but on Windows it' a whole different story. Please see noble's documentation for more info.

Installation

npm install codiejs

API

Connect

var codie = new Codie("Codie_001"); // pass your codie's name to the constructor
codie.connect(function (error) {
    if (!error) {
        // do something with codie
    }
});

Commands

Move
codie.move (distance, leftSpeed, rightSpeed, cb);
Enable motors
codie.enableMotorBoth (leftSpeed, rightSpeed, cb);
Enable left motor
codie.enableMotorLeft (speed, cb);
Enable right motor
codie.enableMotorRight (speed, cb);
Turn

Note:

  • positive speed -> left turn
  • negative speed -> right turn
codie.turn (angle, speed, cb);
Beep
codie.beep (volume, frequency, duration, cb);
Set led colour
codie.setColor (hue, saturation, value, cb);
Start animation

Possible animation values: 0, 1

codie.setAnimation (animation, hue, saturation, repeat, speed, cb);

Sensors

Distance
codie.getDistance (cb(sensorData));
Battery
codie.getBattery (cb(sensorData));
Sound
codie.getSound (cb(sensorData));
Light
codie.getLight (cb(sensorData));
Line
codie.getLine (cb(sensorData));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published