O'Reilly logo

Raspberry Pi LED Blueprints by Agus Kurniawan

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

Connecting PhoneGap Android to Raspberry Pi through RESTful

It's more convenient to control three LEDs from the Android app. It's fine if you use a browser on Android and navigate to the RESTful server on Raspberry Pi. We call our RESTful from the Android app. In this section, we will build a PhoneGap app for the Android target and control the three LEDs. We use the previous program, the ledrest.js file, as a RESTful server, which controls LEDs on Raspberry Pi.

First, we create a PhoneGap project named leds-android:

$ phonegap create leds-android
$ cd /leds-android
$ phonegap build android --verbose

Try to run the program on the Android emulator for testing purposes:

$ phonegap run android --emulator --verbose

If the program runs well, we continue ...

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