Giter Club home page Giter Club logo

dyalf's Introduction

Dyalf

A Node.js Library to interact with Star Wars Sphero droids ๐Ÿค–

Pair droids with your device

To pair droids with your device for the first time, you need an external tool to find UUID. I use

node blescanner.js

included in this library.

Usage

const dyalf = require('./dyalf');


let r2 = new dyalf.R2D2('4bef2b0786334e2fac126c55f7f2d057');


let main = async () => {
    await r2.connect();
    await r2.openCarriage();
    await r2.closeCarriage();
    await r2.sleep(1000);
    await r2.animate(7);
    for (var i = -160; i < 180; i += 5) {
        await r2.rotateTop(i);
    }
    await r2.sleep(1000);
    await r2.off();
    dyalf.shutdown();
};

main();

Troubleshooting

Use @abandonware/noble npm package to avoid the xpc-connection error.

MacOS won't connect to the droid

Restart your Mac is a valid option! Alternatively:

  • Turn off Bluetooth
  • Run the following code in your shell
rm -v ~/Library/Preferences/ByHost/com.apple.Bluetooth.*.plist
sudo rm /Library/Preferences/com.apple.Bluetooth.plist
  • Turn Bluetooth back on

You can automate this procedure using blueutil:

blueutil off
rm -v ~/Library/Preferences/ByHost/com.apple.Bluetooth.*.plist
sudo rm /Library/Preferences/com.apple.Bluetooth.plist
blueutil on

License

MIT - Copyright (c) Andrea Stagi

dyalf's People

Contributors

astagi avatar careless2000 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.