O'Reilly logo

Programming the BeagleBone by Yogesh Chavan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Program to control an LED through web browser

We have created a webserver on port 3001. Now it is time to turn an external LED on and off using a HTML page remotely. Just by changing variable ledPin in the following JavaScript program to USR0, you can turn on/off onboard USER0 LED. This will save wiring efforts. We are going to use the JavaScript socket.io library for this. This library allows real-time, full-duplex, communication by sending and receiving events. Let's install it by running the following command in the BeagleBone shell.

sudo npm install –g socket.io

The npm is Node Package Manager. It is a package manager for JavaScript libraries. It works independent of the Debian package manager. The source code of socket.io is available here: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required