{"_id":"563d09d9913e650d00b65f92","user":"5564f227f0f70f0d00a9ab20","githubsync":"","project":"56009c541503430d007cc951","category":{"_id":"56009c581503430d007cc955","__v":41,"project":"56009c541503430d007cc951","version":"56009c571503430d007cc954","pages":["56009c591503430d007cc957","56009c7f0c703d19009531c6","56009c911503430d007cc958","56009c9c1503430d007cc95a","56009ca697f69f1700f21a55","56009cb81503430d007cc95c","56009cc80c703d19009531c8","56009ce18c0c9d0d00dcaef8","56009cf21503430d007cc95e","56009cfe81a9670d006d146a","56009d0781a9670d006d146c","56009d1d81a9670d006d146e","56009d271503430d007cc960","56009d581503430d007cc962","56009d651503430d007cc964","56009d711503430d007cc966","56009d8d81a9670d006d1472","56009d970c703d19009531ce","56009da197f69f1700f21a5a","56009dae3aa0520d00da0bff","56009db83aa0520d00da0c01","56009dcf81a9670d006d1474","56009ddb3aa0520d00da0c04","56009de597f69f1700f21a5d","56009df80c703d19009531d0","56009e0d8c0c9d0d00dcaefa","56009e213aa0520d00da0c08","56009e2c81a9670d006d1476","5600a4971503430d007cc97d","561c5a6b01e1c417001f54f1","561d9845d712bc0d00777b72","563cfe55d8f2d20d00448d14","563d09d9913e650d00b65f92","566b3b8614c22f1900f00b7b","568ff8529ebef90d00872887","568ff8ed4719c119002ce637","5690922a208b910d00ed77b4","56a93fd311d0390d00a3d29a","56b25cc8a5a1020d00cf4cc3","56b25f02147e900d00d64990","56b291ed4e71701700232ea4"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-22T00:10:00.324Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"version":{"_id":"56009c571503430d007cc954","__v":1,"project":"56009c541503430d007cc951","createdAt":"2015-09-22T00:09:59.421Z","releaseDate":"2015-09-22T00:09:59.421Z","categories":["56009c581503430d007cc955"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":11,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-06T20:13:13.383Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":12,"body":"## What are we doing?\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/vt5NTDV2QWyfXGcMdaTX_Screen%20Shot%202015-11-06%20at%202.09.26%20PM.png\",\n        \"Screen Shot 2015-11-06 at 2.09.26 PM.png\",\n        \"743\",\n        \"455\",\n        \"#6b8ba5\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThis tutorial will guide you in setting up your Light Blue Bean (bluetooth Arduino), flashing it with firmata (firmware for dynamic pin control), and then using NodeJS on OSX/Linux to control it from Octoblu. \n\nThere is a wonderful NodeJS robotics framework called [Johnny-Five](http://johnny-five.io) that lets you use a common API accross multiple hardware platforms. By flashing bean-firmata to your bean and using Bean-IO for Johnny-Five, you'll be able to use Johnny-Five with your bean.\n\nFirst, you'll need to set-up and flash a Light Blue Bean.\n\n## Set-up Bean Loader and Arduino\n\n Install Bean Loader and the latest Arduino IDE\nThis guide will show you how! [Getting Started with Light Blue Bean](http://legacy.punchthrough.com/bean/getting-started-osx/)\n\n## Flash bean-firmata\n\n1. Open up the Arduino IDE\n2. Paste the [bean-firmata sketch](https://github.com/jacobrosenthal/arduino/blob/bean/examples/StandardFirmata/StandardFirmata.ino) into the Arduino editor.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/nsVhJfjSSFKJbl7SOgqf_Screen%20Shot%202015-11-06%20at%201.45.33%20PM.png\",\n        \"Screen Shot 2015-11-06 at 1.45.33 PM.png\",\n        \"495\",\n        \"588\",\n        \"#0d8b8e\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n3. Select Tools -> Boards -> Light Blue Bean\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/YyNnBBOrQACnoPVBBpwS_Screen%20Shot%202015-11-06%20at%201.45.47%20PM.png\",\n        \"Screen Shot 2015-11-06 at 1.45.47 PM.png\",\n        \"631\",\n        \"657\",\n        \"#1ca3a9\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n4. Open up Bean Loader\n5. In the Arduino IDE press the arrow to Upload the firmware\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/PWre35DaT32EvwLIookr_Screen%20Shot%202015-11-06%20at%201.50.57%20PM.png\",\n        \"Screen Shot 2015-11-06 at 1.50.57 PM.png\",\n        \"191\",\n        \"28\",\n        \"#4bb4bb\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nBean Loader will now show that the firmware is available for flashing to a bean \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/La482nbURn636SevirqB_Screen%20Shot%202015-11-06%20at%201.48.31%20PM.png\",\n        \"Screen Shot 2015-11-06 at 1.48.31 PM.png\",\n        \"575\",\n        \"306\",\n        \"#0e55c7\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n6. Connect to your Bean, then right click and select \"Program Sketch\" , this can take a minute.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/bnXyrMhOSfqCNtHbFHCW_Screen%20Shot%202015-11-06%20at%201.48.46%20PM.png\",\n        \"Screen Shot 2015-11-06 at 1.48.46 PM.png\",\n        \"696\",\n        \"311\",\n        \"#0f4889\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n## Set-Up NodeJS Script\n\n1. Clone this repo down [meshblu-bean-io-examples](https://github.com/octoblu/meshblu-bean-io-example)\n\nYou can do so by typing this in the terminal\n\n```\ngit clone https://github.com/octoblu/meshblu-bean-io-example\n```\n\n2. Copy and paste this to your terminal whilst in the directory and hit enter.\n```\nnpm install && \\\nnode node_modules/meshblu-util/command-register.js -t bean-io > meshblu.json && \\\nnode node_modules/meshblu-util/command-claim.js \n```\nUpon completion your browser will be launched and you will be prompted to claim a device in your Octoblu account. Give it a name and claim it.\n\n3. You can now run three different examples, each one has a corresponding flow (see next section)\n\nTo run them simply type:\n\n```\nnode button-example.js\n```\n\n## Octoblu Flows\n\n### Button Example\n\nFlow: [Octoblu Bean Button Example](https://app.octoblu.com/bluprints/import/f23cb673-367f-4487-87af-f7c62136490a)\n\nWiring: [Hackster tutorial](https://www.hackster.io/3043/lightblue-bean-octoblu-542717?ref=platform&ref_id=2435_trending___&offset=25)\n\n### Accelerometer and Temperature Example\n\nFlow: [Bean-io Accel-Temp Example](https://app.octoblu.com/bluprints/import/27c796ea-39a4-45be-b8db-ad681bfba3d9)\n\n### LED Example\n\nFlow: [Bean LED Flow](https://app.octoblu.com/bluprints/import/0bb3904b-d4b8-40bc-b373-41b3eea61927)\n\n\n\n### Pin Mappings\n\nBean to Arduino UNO\n\n\n| Bean Port | Arduino Pin | Type |\n|----------|-------------|------|\n|A0|18|Analog/Digital|\n|A1|19|AnalogDigital|\n|0|6|Digital — Unavailable right now from firmata|\n|1|9|Digital — Unavailable right now from firmata|\n|2|10|Digital|\n|3|11|Digital|\n|4|12|Digital|\n|5|13|Digital|","excerpt":"Use bean-io + octoblu to run johnny-five with the Light Blue Bean","slug":"bean-io","type":"basic","title":"Bean-IO"}

Bean-IO

Use bean-io + octoblu to run johnny-five with the Light Blue Bean

## What are we doing? [block:image] { "images": [ { "image": [ "https://files.readme.io/vt5NTDV2QWyfXGcMdaTX_Screen%20Shot%202015-11-06%20at%202.09.26%20PM.png", "Screen Shot 2015-11-06 at 2.09.26 PM.png", "743", "455", "#6b8ba5", "" ] } ] } [/block] This tutorial will guide you in setting up your Light Blue Bean (bluetooth Arduino), flashing it with firmata (firmware for dynamic pin control), and then using NodeJS on OSX/Linux to control it from Octoblu. There is a wonderful NodeJS robotics framework called [Johnny-Five](http://johnny-five.io) that lets you use a common API accross multiple hardware platforms. By flashing bean-firmata to your bean and using Bean-IO for Johnny-Five, you'll be able to use Johnny-Five with your bean. First, you'll need to set-up and flash a Light Blue Bean. ## Set-up Bean Loader and Arduino Install Bean Loader and the latest Arduino IDE This guide will show you how! [Getting Started with Light Blue Bean](http://legacy.punchthrough.com/bean/getting-started-osx/) ## Flash bean-firmata 1. Open up the Arduino IDE 2. Paste the [bean-firmata sketch](https://github.com/jacobrosenthal/arduino/blob/bean/examples/StandardFirmata/StandardFirmata.ino) into the Arduino editor. [block:image] { "images": [ { "image": [ "https://files.readme.io/nsVhJfjSSFKJbl7SOgqf_Screen%20Shot%202015-11-06%20at%201.45.33%20PM.png", "Screen Shot 2015-11-06 at 1.45.33 PM.png", "495", "588", "#0d8b8e", "" ] } ] } [/block] 3. Select Tools -> Boards -> Light Blue Bean [block:image] { "images": [ { "image": [ "https://files.readme.io/YyNnBBOrQACnoPVBBpwS_Screen%20Shot%202015-11-06%20at%201.45.47%20PM.png", "Screen Shot 2015-11-06 at 1.45.47 PM.png", "631", "657", "#1ca3a9", "" ] } ] } [/block] 4. Open up Bean Loader 5. In the Arduino IDE press the arrow to Upload the firmware [block:image] { "images": [ { "image": [ "https://files.readme.io/PWre35DaT32EvwLIookr_Screen%20Shot%202015-11-06%20at%201.50.57%20PM.png", "Screen Shot 2015-11-06 at 1.50.57 PM.png", "191", "28", "#4bb4bb", "" ] } ] } [/block] Bean Loader will now show that the firmware is available for flashing to a bean [block:image] { "images": [ { "image": [ "https://files.readme.io/La482nbURn636SevirqB_Screen%20Shot%202015-11-06%20at%201.48.31%20PM.png", "Screen Shot 2015-11-06 at 1.48.31 PM.png", "575", "306", "#0e55c7", "" ] } ] } [/block] 6. Connect to your Bean, then right click and select "Program Sketch" , this can take a minute. [block:image] { "images": [ { "image": [ "https://files.readme.io/bnXyrMhOSfqCNtHbFHCW_Screen%20Shot%202015-11-06%20at%201.48.46%20PM.png", "Screen Shot 2015-11-06 at 1.48.46 PM.png", "696", "311", "#0f4889", "" ] } ] } [/block] ## Set-Up NodeJS Script 1. Clone this repo down [meshblu-bean-io-examples](https://github.com/octoblu/meshblu-bean-io-example) You can do so by typing this in the terminal ``` git clone https://github.com/octoblu/meshblu-bean-io-example ``` 2. Copy and paste this to your terminal whilst in the directory and hit enter. ``` npm install && \ node node_modules/meshblu-util/command-register.js -t bean-io > meshblu.json && \ node node_modules/meshblu-util/command-claim.js ``` Upon completion your browser will be launched and you will be prompted to claim a device in your Octoblu account. Give it a name and claim it. 3. You can now run three different examples, each one has a corresponding flow (see next section) To run them simply type: ``` node button-example.js ``` ## Octoblu Flows ### Button Example Flow: [Octoblu Bean Button Example](https://app.octoblu.com/bluprints/import/f23cb673-367f-4487-87af-f7c62136490a) Wiring: [Hackster tutorial](https://www.hackster.io/3043/lightblue-bean-octoblu-542717?ref=platform&ref_id=2435_trending___&offset=25) ### Accelerometer and Temperature Example Flow: [Bean-io Accel-Temp Example](https://app.octoblu.com/bluprints/import/27c796ea-39a4-45be-b8db-ad681bfba3d9) ### LED Example Flow: [Bean LED Flow](https://app.octoblu.com/bluprints/import/0bb3904b-d4b8-40bc-b373-41b3eea61927) ### Pin Mappings Bean to Arduino UNO | Bean Port | Arduino Pin | Type | |----------|-------------|------| |A0|18|Analog/Digital| |A1|19|AnalogDigital| |0|6|Digital — Unavailable right now from firmata| |1|9|Digital — Unavailable right now from firmata| |2|10|Digital| |3|11|Digital| |4|12|Digital| |5|13|Digital|