APPENDIX 4
Controlling the Arduino with a Browser
For many hardware projects, you’ll need an application on your computer
that visualizes some sensor data or that controls your device. In the Arduino
scene, many people use Processing
1
for this purpose. Processing is a good
choice. It’s fast, it has excellent multimedia support, and it supports a lot of
libraries because it uses the Java Virtual Machine (JVM).
Processing has some disadvantages, too. It is very similar to Java; that is, it’s
a statically typed programming language. As such, it isn’t a good tool for
building prototypes interactively and incrementally. Also, you have to install
Java and the Processing environment to use it.
In many cases it’s a better choice to use a regular web browser to write
applications that communicate with the Arduino. Web browsers have excellent
multimedia support, too, and the JavaScript programming language is easy
to learn and widely available.
The only problem is that most web browsers don’t support serial port program-
ming. But fortunately, Google Chrome comes with native support for serial
port programming. Due to security restrictions, you can access the correspond-
ing library only in Chrome Web apps and not on regular websites. Fortunately,
it’s not difficult to create Chrome apps, and in this appendix you’ll learn how.
What Are Google Chrome Apps?
Over the years, web browsers have evolved from simple applications used for
rendering HTML documents to full-blown programming environments. They’ve
become so powerful that you can barely distinguish them from operating
1.
http://processing.org
report erratum • discuss
www.it-ebooks.info