Breakout is a javascript library and toolkit for connecting Arduino and other IOBoards to the web
MIT License
Breakout is a prototyping tool for exploring the intersection of the web and the physical world. The popular Arduino platform and the Firmata protocol are leveraged to enable users to access physical input and output purely from javascript. This makes it easy for anyone familiar with javascript and basic web development to explore the possibilities of using sensors and actuators in their web applications. Furthermore, the Breakout framework includes a growing library of hardware abstractions such as buttons, leds, servo motors, accelerometers, gyros, etc enabling the user to easily interface with a range of sensors and actuators using just a few lines of javascript code.
Breakout grew out of a need for a simple platform to enable designers to prototype functional web-based interfaces to the physical world. It is based largely on the Funnel toolkit and informed by the experiences of the developers of both Funnel and Breakout as designers, technologists and educators.
See the project site for detailed documentation and other helpful information.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hello World</title>
</head>
<body>
<button id="ledToggle">Toggle LED</button>
<p id="btnStatus"></p>
<script src="../../dist/Breakout.js"></script>
<script>
var arduino = new BO.IOBoard("localhost", 8887);
arduino.addEventListener(BO.IOBoardEvent.READY, function (event) {
var led = new BO.io.LED(arduino, arduino.getDigitalPin(11)),
button = new BO.io.Button(arduino, arduino.getDigitalPin(2)),
toggleBtn = document.getElementById("ledToggle"),
btnStatus = document.getElementById("btnStatus");
toggleBtn.addEventListener("click", function (event) {
led.toggle();
});
button.addEventListener(BO.io.ButtonEvent.PRESS, function (event) {
btnStatus.innerHTML = "Button " + event.target.pinNumber + " pressed";
});
button.addEventListener(BO.io.ButtonEvent.RELEASE, function (event) {
btnStatus.innerHTML = "Button " + event.target.pinNumber + " released";
});
});
</script>
</body>
</html>
See the detailed Getting Started guide or the quickstart guide below.
Wire up a button and led to your I/O board as illustrated on page 2 in Breakout/examples/schematics.pdf.
Sketch > Include Library > Manage Libraries
then search for "ConfigurableFirmata" and click Install after tapping on the ConfigurableFirmata item in the filtered results. Otherwise, following the instructions in the ConfigurableFirmata readme.Breakout/firmata/BreakoutFirmata
and open BreakoutFirmata.ino
in the Arduino IDE. Compile and upload the sketch to your board.Breakout/server/
. Unzip and open the folder for your platform and launch the application. Mac OS X users may need to temporarily disable Gatekeeper to launch the app for the first time. Note: Linux users may need to run sudo apt-get install librxtx-java
or manually install the librxtxSerial.so driver before launching the BreakoutServer.jar application.Schematics for the examples can be found here: http://soundanalogous.github.io/Breakout/examples/schematics.pdf
Note OS X users: If you are running Mavericks or later, you will need to disable the App Nap feature for Breakout Server. Right-click on the Breakout Server icon then select Get Info. Check the Prevent App Nap
box under the General section in the info panel. If you don't disable it, the connection will be dropped a few seconds after the window goes out of focus.
You can also interact with the examples on your smartphone or tablet as long as your mobile browser supports websockets. Instead of localhost:8887/examples/
enter the IP address or hostname of the computer running Breakout Server (192.168.2.1:8887/examples/
or yourhostname.local:8887/examples/
). Also make sure your mobile device is connected to the same wi-fi network as the computer running the Breakout Server application.
For more information on using Breakout Server including enabling multiple client connections, changing the webserver root directory, enabling auto start mode, or using Breakout with mobile devices, see Using Breakout Server.
As an alternative to the Breakout Server application, a node.js-based server is also available. See breakout-server for details.
Breakout is supported for Arduino 1.0 and higher Download Arduino.
You will need one of the following I/O boards:
OS:
Desktop Browsers:
Mobile Browsers (browser must support websockets):
Contributions are welcome. If you have any ideas, suggestions for improvements, examples to share, or anything else you'd like to contribute please get in touch.
To contribute, fork Breakout and create a feature branch branch. Submit pull requests for bug fixes and small changes. For any larger changes, please first start a discussion by opening a new issue.
See Breakout/build/README.md for instructions on building Breakout.
Breakout is developed by Jeff Hoefs.
Breakout is based on the as3 library of Funnel. The author is also a contributor to the Funnel as3 library.
Logo and icon designed by Claire Lin.
Breakout Server uses webbit
Contributors:
Breakout is distributed under the terms of the MIT License. See the LICENSE file.
See the ChangeLog file.