Control The Arduino From An App Using BLE. This example shows how to make an app that controls an Arduino board.
Communication with the Arduino is made using Bluetooth Low Energy (BLE). Your Arduino board therefore needs a BLE shield for this example to work.
You can browse the source code for this example at the Evothings GitHub repository
The file arduinoledonoffble/arduinoledonoffble.ino contains the Arduino BLE server code that listens for commands from the app.
This example runs in Evothings Viewer on Android or iOS.
You need to run the example in Evothings Viewer. Alternatively, you can make a Cordova application if you wish to distribute the app. You then need to include the Cordova plugin com.evothings.ble. Read more in the documentation of the Evothings Viewer.
An iOS device or an Android device with support for Bluetooth 4.0 (which includes BLE) is required. In addition Android 4.3 or later is needed. Please note that BLE support on Android is still not fully mature. As a result, you may experience difficulties running this example. If the app stops working, restart Evothings Viewer and/or reset Bluetooth on the device.
For the Arduino setup, you need:
Here is the sketch:
Here is a photo of a board configured to work with this example. Note that output pin 2 is used (it may look like pin 3 in the photo).
Follow these steps to get started with this example: