Skip to content

Instantly share code, notes, and snippets.

@ajfisher
Last active May 3, 2016 10:31
Show Gist options
  • Save ajfisher/67af8f62774c20b6fed6 to your computer and use it in GitHub Desktop.
Save ajfisher/67af8f62774c20b6fed6 to your computer and use it in GitHub Desktop.
Preparation for BuzzConf

BuzzConf NodeBots workshop

During this workshop we will be using mbots from Makeblock. These robots are quick to construct but can be used to do a variety of activites including:

  • Control remotely over bluetooth
  • Use distance sensors for obstacle detection
  • Play a tune via a speaker
  • Detect lines and follow them

And all of this can be done using JavaScript via NodeJS and Johnny Five.

Workshop requirements

You will need the following:

  • a ticket to the workshop as this includes the cost of an mBot within it. You will be able to take this home with you after the session for more hacking.
  • A laptop with a recent desktop OS (Win, Mac, Linux all fine)
  • A sense of fun and desire to learn new things
  • Some JavaScript knowledge

Pre Workshop installation

Before you come to the workshop please ensure you've done the tasks below. On a good internet connection this process takes about 20 minutes. On poor conference wifi or 3G you may be looking at over an hour to do this on the day which means you'll get less value out of the session.

  1. Install Arduino for your OS. If you have it installed, please update it to a recent 1.6.x version.
  2. Install NodeJS. Note that there are problems with NodeJS 4.x - as such use 0.12.7 for the moment. If you are using v4 then please ensure you have and know how to use nvm and have 0.12.7 installed for use.
  3. Test installation of johnny-five. You can do this using npm install johnny-five. If you get any errors, drop into the Johnny Five Gitter and we can get you sorted out.
  4. Git clone this GIST into a new folder
  5. From a command line in the folder run npm install to get the dependencies
  6. Make sure you have ./node_modules/.bin/ on your $PATH variable so you can run executable scripts local to the project.
  7. Install the drivers (Win / Mac only) for the mBot from node_modules/mbot_nodebots/drivers (see mBot readme for more )

Bookmark this page in order to get any latest updates required before the session.

Workshop notes

These are the things to do in the workshop (assume you've done the bits above).

Install firmata using interchange

interchange install git+https://github.com/Makeblock-official/mbot_nodebots -a uno -p <port> --firmata=usb

Make the onboard LED attached to pin 13 blink using the code below save to a file called led.js in the root of your project folder.

var five = require("johnny-five");

var board = new five.Board();

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

    var led = five.Led({pin:13});

    led.blink(1000);

});

Use the examples in node_modules/mbot_nodebots/examples to learn more about the capabilities of your robot.

More examples are available at http://johnny-five.io

The MIT License (MIT)
Copyright (c) 2015 ajfisher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{
"name": "buzzconf-nodebots",
"version": "0.2.2",
"private": true,
"description": "Files needed for Buzzconf workshop",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@gist.github.com/67af8f62774c20b6fed6.git"
},
"keywords": [
"buzzconf",
"johnny-five",
"arduino",
"mbot"
],
"author": "Andrew Fisher <ajfisher.td@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://gist.github.com/67af8f62774c20b6fed6"
},
"homepage": "https://gist.github.com/67af8f62774c20b6fed6",
"dependencies": {
"johnny-five": "^0.9.44",
"mbot_nodebots": "makeblock-official/mbot_nodebots",
"nodebots-interchange": "^1.0.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment