📜 ⬆️ ⬇️

Connect to Intel Edison via Android with Bluetooth LE (BLE)

Hi, Habr! Today let's talk about BLE, a low-power Bluetooth technology that has found application in both commercial and purely amateur products due to its low cost and equally low appetite for battery resources. These factors make BLE an excellent choice for connecting a smartphone or tablet running Android with projects based on Intel development boards - Edison or Galileo.



The task of the article proposed below is to show how to write code for connecting hardware using the BLE protocol using the example of the Intel Edison platform and an Android device with Bluetooth version 4.0. It uses only free software and inexpensive “iron” components that are ready to go.

Let's start, as expected, with the theory.
')

What is BLE?


We get acquainted: technology BLE, it is Bluetooth LE; full name - Bluetooth Low Energy (or Bluetooth Smart). A wireless personal area network technology developed and distributed by the Bluetooth Special Interest Group ( Bluetooth SIG ). The purpose of Bluetooth LE is to use in the fields of health and home entertainment, in sports and physical education, in cars.

Bluetooth LE was first introduced in 2006 by Nokia, codenamed Wibree . And in the Bluetooth standard, it appeared in 2010 in the Bluetooth 4.0 version.

BLE allows devices to be content with significantly less energy than standard Bluetooth connections. At the same time, it provides most of the usual functionality at a distance of approximately half as much as usual - about 15 meters. Bluetooth LE devices can work for years without the need to change or recharge the battery. Beacons, like Estimote devices , are already able to work on batteries up to 3 (three!) Years.

Iron


The main character of the publication will be Intel Edison, although many things are applicable to Intel Galileo. In our IoT project, we will use the physical sensors and controls of the Groed system from Seeed Studio. Namely:


A few nuances of iron:

  1. Although the Grove entry-level kit (Starter Kit) is designed for the Intel Galileo platform, it works quite well with Edison. You can, of course, purchase Grove components separately, however, using a ready-made kit is a more economical way.
  2. The project used my Lenovo tablet on Android, however, any other device with Bluetooth 4.0 support, running under this OS version 4.3 or higher, should be suitable.
  3. Writing code for Intel Edison, an Android device (and writing this article) happened on a Dell XPS12 laptop. Development on a Mac or Linux system is also possible.

Soft


I used several free programs - to play this example, you also have to put them:


All the above software is available for Windows and Linux, but in the article we will understand the example of Windows.

Get acquainted closer with iron


Intel Edison


Intel Edison is the first offer in a series of low-cost multipurpose computer platforms. This platform is designed for simple and quick prototyping of IoT projects, while ensuring the creation of production products for the commercialization of the project.

The “heart” of the Intel Edison board is the Intel’s 22nm system-on-chip, which includes a dual-core Atom processor running at 500 MHz. The tiny form factor of this SoC includes 40-pin GPIO interfaces, 1 GB of LPDDR3 class RAM, 4 GB on an eMMC drive, and a dual-function Wi-Fi + Bluetooth module. Fills the platform with a full-fledged Linux kernel, and to squeeze all the juices (incorporated in Edison), you will need to write a low-level code for it.

But Linux on Edison also contains the ability to run Linux programs on the Arduino facilities. Simply put, this means the possibility of writing familiar Arduino-sketches and launching them on Edison. This is what we are going to do.

Learn more about the Edison system at the Intel site .

»Arduino board


The Arduino for Intel Galileo is designed for two purposes. First, it is a larger prototyping platform — with easy access to I / O interfaces. And secondly, we have a computing platform that is fully compatible with Arduino. In practice, this means that we can use standard Arduino expansion boards on Intel Edison (or on Intel Galileo).


Intel Edison installed in Arduino board

»Grove Starter Kit Plus


The full name of this kit is “Grove Starter Kit Plus - Intel IoT Edition for Intel Galileo Gen 2 Developer Kit”. Initially, the set was intended for the second generation Intel Galileo board - fortunately, the Arduino board is fully compatible with Intel Edison.

The kit is designed to simplify prototyping and working with sensors, mechanisms and modules-shields. Included is an Arduino-compatible module on standard 4-pin interfaces. Interfaces are powered by I / O ports using the included cables. Connecting cables to the sensors is thought out very conveniently: you can deal with the projects themselves, and not understand all these small wiring, constantly correct something, worry about the polarity of the connection, etc. More information about the kit (and its purchase) is on Seeed Studio .

By the way, the creator of the set of Grove, the company Seeed Studios, offers a collection of useful online resources. I especially recommend exploring or downloading materials from the Sketchbook for Beginners series (English), and at least adding to your favorites the Grove Wiki .


Developer Kit "Grove Starter Kit Plus - Intel IoT Edition for Intel Galileo Gen 2"

"Grove BLE (V1)


We will use the Grove Bluetooth Low Energy v1 module, which is not included in the entry-level package, but the pin-to-pin option is compatible with the Grove module and connecting wires. It is also a relatively inexpensive BLE module - at the time of this writing, I still could not find anything cheaper.

The basis of the Grove BLE v1 shild is the standard for devices of this class, the CC2540 chip from Texas Instruments, the same microchip is used in some other products. Therefore, if there is another BLE-module based on TI CC2540 on hand, the code sample can be adapted to it, moreover, with minimal effort.

I note that the Intel Edison board already has a built-in wireless module that supports Wi-Fi and Bluetooth 4.0 / BLE, however, the Grove-BLE module at times simplifies both hardware and software settings. Using the Grove module also means that the project is easily adaptable for the Intel Galileo platform.


Module Grove BLE V1

More information about the module Grove BLE v1 on the manufacturer's website .

Debugging on Android devices


BLE support in Android appeared from version 4.3 (API level 18). Accordingly, to work with BLE, the Android version on the device must be at least 4.3. Learn more about Android BLE here .

If you are taking the first steps in mastering Android development, then on a tablet / phone you first need to activate developer functions - they allow you to run and debug the code. Activation of the developer mode is as follows: open the settings, scroll through the menu to the bottom, find the item “About device” and click on the version number of the build 7 (seven) times. Now the inclusion of developer mode (Developer Options) is displayed in the bottom of the settings; Do not forget to tick the “USB debugging” checkbox. Learn more about developer mode here .

Installing software. Getting ready to code!


»Arduino IDE for Intel Galileo


To deploy sketches to Intel Edison or Galileo, we will need to download a specially prepared version of the Arduino IDE. At the time of this writing, the current version is 1.5.3, and the source is here .

Intel Edison Drivers


The link above also contains the drivers for Intel Edison: they also need to be downloaded and installed. They are located at the bottom of the page, in the category “Software and drivers” - “Driver Software”. Or here's a direct link (at the time of writing, the driver version was 1.0.0)

If you have additional questions, I highly recommend the “Excellent Started Guide ” written in excellent English.

Android Studio


Android Studio is a new Java IDE for development on Android. This package is based on IntelliJ IDEA . At the moment, the package has the status of a beta version, but it works quite stably, and the functionality is fully provided. If you are confidently working on Andorid-development in the Eclipse environment for Java (or IntellliJ IDEA), then while working in Android Studio there should not be any particular difficulties or problems - it is enough to look at key points in the training materials.

Thanks to the inclusion of the Android SDK for developers in Android Studio, the installation procedure is greatly simplified. It comes down to downloading, unpacking the contents of the zip file and running the studio.exe installer from the Bin folder.

About Android Studio is written more here .

Android SDK


You may also need to download additional SDKs. The most convenient way to do this is using the “SDK Manager” button on the Android Studio interface toolbar. Configuring and configuring the Android SDK is a topic for a separate article, so we will not dwell on this. Detailed information on additional SDRs is selected on this page .

If SDK-packages for Android are already installed in the system, the Android Studio platform allows you to specify the correct path to their location in the file system. To access this menu in Android Studio, click on Configure -> Project Defaults -> Project Structure . In the window that appears, you can register the path to the folder with the SDK.


Specify the path to the SDK in Android Studio

Testing Intel Edison


Before starting to get acquainted with the capabilities of the board (below), I strongly recommend to make sure that the platform is able to correctly launch the Blink sketch sample. The sketch is included in the Arduino IDE downloadable add-on; Its location: examples -> 01.Basics -> Blink (folder) .

Edison developers have prepared a decent guidebook for beginners.

Unfading Hello World for Android Verification Classics


After installing Android Studio, make sure that the program allows you to create new projects and run them on your Android device.

  1. We connect the Android device to the computer;
  2. Open Android Studio;
  3. Choose "New project ...";
  4. Specify the name and path, 3 times click "Next" (API 15 / Blank Activity);
  5. Click "Finish" and wait until the project is created (the process can take seconds to 20+);
  6. We press the green Play icon in the toolbar;
  7. Choose our device and click "OK".

If everything was done correctly, then “Hello world!” Will appear on the screen of the device:


Hello World Android Studio App

How does BLE work?


The principle of operation of BLE is already described in its title: Low Energy. The protocol involves the transfer of data in short packets as needed, then - turning off the transmitter. Low power consumption is partly achieved by applying precisely this principle. Instead of the classic tandem in conventional Bluetooth, BLE devices communicate with each other only when they need to send or receive information.

The BLE protocol is strictly structured according to the principle of its communication with other devices. First, devices learn available services for sending / receiving data; An integral part of these services is their characteristics (characteristics), which determine the type of data for future transmission. Characteristics, for reasons of clarity, may have descriptors that help determine the type of data. For example, let’s analyze a service called “Heart Rate Monitor” (heart rate monitor) - among its characteristics there are such as “pulse measurement”.

Most of the Bluetooth LE APIs allow you to search for local devices and determine the services, features and descriptors available in them.

Key terms and concepts for the BLE protocol


I bring to your attention a brief overview of the key terms of the BLE protocol and its concepts. Before starting work on the BLE project, you need to understand each of them.

»General Attribute Profile (GATT)


The General Attribute Protocol (GATT) profile is a mandatory profile with general specifications for sending and receiving short portions of data known in Bluetooth Low Link called “attributes”. All current LE application profiles are based on GATT. The Institute for Standardization and Protocol Development - Bluetooth Special Interest Group has already set several profiles for BLE devices. These profiles are specifications that describe how to use and interact with devices.

»Attribute Protocol (ATT)


Attribute Protocol (ATT) is based on GATT. ATT is an optimized protocol created exclusively for BLE devices. The principle of ATT is to send as few bytes as possible. Each attribute has a unique universal identifier, a UUID . It is a standardized 128-bit string ID used to identify unique information. The format of the attributes transmitted as ATT is of two types: characteristics and services:

»Characteristic


The characteristic contains a unique parameter, as well as descriptors. The number of descriptors can be zero, that is, it is not an obligatory part of the characteristic. Descriptors describe the value of the characteristic.

»Descriptors


Descriptors are specific attributes that describe the value of a characteristic. Descriptors can be in the form of clear descriptions in a completely human language, define units of measurement, and also set a number of acceptable values.

»Service (Service)


Service is a set of characteristics. A list of existing GATT-based profiles can be viewed here .

Sending data from Android to Intel Edison


»What we need


The rest of this article assumes that the reader has a development system that is configured for both Intel Edison and Android. I recommend to look at the list of the following stages of preliminary preparation, and if necessary, return to the previous parts of the article.



BLE on Android


The finished project can be pulled from GitHub , however, I recommend creating your own project by entering the code line by line, based on the link above.

»Create a new project


Open Android Studio (or another IDE of your choice), create a new empty Android application and call it BLEConnect . Make sure that the minimum level of the SDK is set to no less than on API 18: otherwise, using the BLE API will not work.


Create a new Android application

Then add to the open file AndroidManifest.xml above the tag
   : 

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!
:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!
  1. :

    <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

    » UI
    : . , ID TextView. activity_main.xml layout, TextView id mainText – .


    id TextView

    » MainActivity
    MainActivity. , , Android Studio . - :
    , Android- BLE; BLE-; Grove BLE ; ; ; , .
    , . .

    Class Level
    , BLE, . Grove BLE v1 ( TI CC2540 – ) , :

    CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
    » Status helper
    TextView, . - statusUpdate – , . UI, .

    » BLE-
    () Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

    » BLE-
    . Bluetooth- startLeScan , .

    API , , , LeScanCallback . , . . .

    @Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
    »
    BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

    . ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

    onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

    @Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
    , . .

    »
    - sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

    setValue . ; , BLE- , .

    Intel Edison.

    Intel Edison, Grove BLE
    . , Intel Edison Arduino.

    Grove, «» Arduino. , Grove BLE v1 UART.


    Intel Edison Grove Shield BLE


    – Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

    GitHub .

    IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

    Intel Edison. setup() , loop() . .

    »
    Grove BLE 9600 , . . AT- Grove BLE . setup() .

    , «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

    »
    – . read() , , print() .

    Edison , 9600 .


    Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

    Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

    GitHub , Grove LCD. , Grove 5, LCD- I2C.


    BLEConnect


    Arduino IDE Serial Monitor BLEConnect-


    Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

    !
  2. :

    <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

    » UI
    : . , ID TextView. activity_main.xml layout, TextView id mainText – .


    id TextView

    » MainActivity
    MainActivity. , , Android Studio . - :
    , Android- BLE; BLE-; Grove BLE ; ; ; , .
    , . .

    Class Level
    , BLE, . Grove BLE v1 ( TI CC2540 – ) , :

    CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
    » Status helper
    TextView, . - statusUpdate – , . UI, .

    » BLE-
    () Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

    » BLE-
    . Bluetooth- startLeScan , .

    API , , , LeScanCallback . , . . .

    @Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
    »
    BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

    . ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

    onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

    @Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
    , . .

    »
    - sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

    setValue . ; , BLE- , .

    Intel Edison.

    Intel Edison, Grove BLE
    . , Intel Edison Arduino.

    Grove, «» Arduino. , Grove BLE v1 UART.


    Intel Edison Grove Shield BLE


    – Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

    GitHub .

    IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

    Intel Edison. setup() , loop() . .

    »
    Grove BLE 9600 , . . AT- Grove BLE . setup() .

    , «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

    »
    – . read() , , print() .

    Edison , 9600 .


    Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

    Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

    GitHub , Grove LCD. , Grove 5, LCD- I2C.


    BLEConnect


    Arduino IDE Serial Monitor BLEConnect-


    Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

    !
  3. :

    <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

    » UI
    : . , ID TextView. activity_main.xml layout, TextView id mainText – .


    id TextView

    » MainActivity
    MainActivity. , , Android Studio . - :
    , Android- BLE; BLE-; Grove BLE ; ; ; , .
    , . .

    Class Level
    , BLE, . Grove BLE v1 ( TI CC2540 – ) , :

    CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
    » Status helper
    TextView, . - statusUpdate – , . UI, .

    » BLE-
    () Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

    » BLE-
    . Bluetooth- startLeScan , .

    API , , , LeScanCallback . , . . .

    @Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
    »
    BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

    . ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

    onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

    @Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
    , . .

    »
    - sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

    setValue . ; , BLE- , .

    Intel Edison.

    Intel Edison, Grove BLE
    . , Intel Edison Arduino.

    Grove, «» Arduino. , Grove BLE v1 UART.


    Intel Edison Grove Shield BLE


    – Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

    GitHub .

    IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

    Intel Edison. setup() , loop() . .

    »
    Grove BLE 9600 , . . AT- Grove BLE . setup() .

    , «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

    »
    – . read() , , print() .

    Edison , 9600 .


    Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

    Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

    GitHub , Grove LCD. , Grove 5, LCD- I2C.


    BLEConnect


    Arduino IDE Serial Monitor BLEConnect-


    Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

    !
  4. :

    <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

    » UI
    : . , ID TextView. activity_main.xml layout, TextView id mainText – .


    id TextView

    » MainActivity
    MainActivity. , , Android Studio . - :
    , Android- BLE; BLE-; Grove BLE ; ; ; , .
    , . .

    Class Level
    , BLE, . Grove BLE v1 ( TI CC2540 – ) , :

    CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
    » Status helper
    TextView, . - statusUpdate – , . UI, .

    » BLE-
    () Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

    » BLE-
    . Bluetooth- startLeScan , .

    API , , , LeScanCallback . , . . .

    @Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
    »
    BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

    . ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

    onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

    @Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
    , . .

    »
    - sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

    setValue . ; , BLE- , .

    Intel Edison.

    Intel Edison, Grove BLE
    . , Intel Edison Arduino.

    Grove, «» Arduino. , Grove BLE v1 UART.


    Intel Edison Grove Shield BLE


    – Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

    GitHub .

    IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

    Intel Edison. setup() , loop() . .

    »
    Grove BLE 9600 , . . AT- Grove BLE . setup() .

    , «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

    »
    – . read() , , print() .

    Edison , 9600 .


    Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

    Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

    GitHub , Grove LCD. , Grove 5, LCD- I2C.


    BLEConnect


    Arduino IDE Serial Monitor BLEConnect-


    Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

    !
  5. :

    <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

    » UI
    : . , ID TextView. activity_main.xml layout, TextView id mainText – .


    id TextView

    » MainActivity
    MainActivity. , , Android Studio . - :
    , Android- BLE; BLE-; Grove BLE ; ; ; , .
    , . .

    Class Level
    , BLE, . Grove BLE v1 ( TI CC2540 – ) , :

    CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
    » Status helper
    TextView, . - statusUpdate – , . UI, .

    » BLE-
    () Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

    » BLE-
    . Bluetooth- startLeScan , .

    API , , , LeScanCallback . , . . .

    @Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
    »
    BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

    . ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

    onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

    @Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
    , . .

    »
    - sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

    setValue . ; , BLE- , .

    Intel Edison.

    Intel Edison, Grove BLE
    . , Intel Edison Arduino.

    Grove, «» Arduino. , Grove BLE v1 UART.


    Intel Edison Grove Shield BLE


    – Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

    GitHub .

    IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

    Intel Edison. setup() , loop() . .

    »
    Grove BLE 9600 , . . AT- Grove BLE . setup() .

    , «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

    »
    – . read() , , print() .

    Edison , 9600 .


    Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

    Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

    GitHub , Grove LCD. , Grove 5, LCD- I2C.


    BLEConnect


    Arduino IDE Serial Monitor BLEConnect-


    Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

    !
  6. :

    <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

    » UI
    : . , ID TextView. activity_main.xml layout, TextView id mainText – .


    id TextView

    » MainActivity
    MainActivity. , , Android Studio . - :
    , Android- BLE; BLE-; Grove BLE ; ; ; , .
    , . .

    Class Level
    , BLE, . Grove BLE v1 ( TI CC2540 – ) , :

    CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
    » Status helper
    TextView, . - statusUpdate – , . UI, .

    » BLE-
    () Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

    » BLE-
    . Bluetooth- startLeScan , .

    API , , , LeScanCallback . , . . .

    @Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
    »
    BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

    . ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

    onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

    @Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
    , . .

    »
    - sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

    setValue . ; , BLE- , .

    Intel Edison.

    Intel Edison, Grove BLE
    . , Intel Edison Arduino.

    Grove, «» Arduino. , Grove BLE v1 UART.


    Intel Edison Grove Shield BLE


    – Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

    GitHub .

    IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

    Intel Edison. setup() , loop() . .

    »
    Grove BLE 9600 , . . AT- Grove BLE . setup() .

    , «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

    »
    – . read() , , print() .

    Edison , 9600 .


    Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

    Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

    GitHub , Grove LCD. , Grove 5, LCD- I2C.


    BLEConnect


    Arduino IDE Serial Monitor BLEConnect-


    Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

    !
:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!
   : 

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!
:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!
   : 

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!
:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!
   : 

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!
:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

:

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

» UI
: . , ID TextView. activity_main.xml layout, TextView id mainText – .


id TextView

» MainActivity
MainActivity. , , Android Studio . - :
, Android- BLE; BLE-; Grove BLE ; ; ; , .
, . .

Class Level
, BLE, . Grove BLE v1 ( TI CC2540 – ) , :

CHARACTERISTIC_TX = "0000ffe1-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_RX = "0000ffe1-0000-1000-8000-00805f9b34fb"
» Status helper
TextView, . - statusUpdate – , . UI, .

» BLE-
() Bluetooth , BLE . Bluetooth (BluetoothManager) getSystemService , – getAdapter() . – getDefaultAdapter Bluetooth Manager.

» BLE-
. Bluetooth- startLeScan , .

API , , , LeScanCallback . , . . .

@Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { … }
»
BLE- /. TI CC2540 Grove BLE ID «0000ffe0-0000-1000-8000-00805f9b34fb». .

. ( ), BluetoothGattCallback , onConnectionStateChanged onServicesDiscovered .

onConnectionStateChanged , , mBluetoothGatt.discoverServices() . .

@Override public void onConnectionStateChange (BluetoothGatt gatt, int status, int newState) { … } @Override public void onServicesDiscovered (BluetoothGatt gatt, int status) { … }
, . .

»
- sendMessage . UDID setValue . , BluetoothGatt writeCharacteristic , .

setValue . ; , BLE- , .

Intel Edison.

Intel Edison, Grove BLE
. , Intel Edison Arduino.

Grove, «» Arduino. , Grove BLE v1 UART.


Intel Edison Grove Shield BLE


– Android Intel Edison. , . Serial Monitor, (IDE) Arduino.

GitHub .

IDE Intel Arduino . « SimpleSerial ». Arduino , Intel Edison . , Edison, Edison Grove BLE. UART microUSB, BLE UART Grove.

Intel Edison. setup() , loop() . .

»
Grove BLE 9600 , . . AT- Grove BLE . setup() .

, «Serial» ( microUSB- UART), – «Serial1» (UART, Grove BLE).

»
– . read() , , print() .

Edison , 9600 .


Verify IDE Arduino ( ) . , Intel Edison ( ). – Android. Serial Monitor Arduino IDE ( ) – .

Android BLEConnect Intel Edison. Serial Monitor «Hello Grove BLE». - , , , Android. , , .

GitHub , Grove LCD. , Grove 5, LCD- I2C.


BLEConnect


Arduino IDE Serial Monitor BLEConnect-


Android, . Android BLE , UI . Arduino Time Library , . GitHub, – .

!

Source: https://habr.com/ru/post/252919/


All Articles