forked from tkuyucu-nordicsemi/drive-sdk
-
Notifications
You must be signed in to change notification settings - Fork 63
Getting Started on Ubuntu
Brian Chapados edited this page Mar 3, 2014
·
16 revisions
These instructions assume you are using Ubuntu Desktop 12.10 (64-bit) or Ubuntu Desktop 13.10 (64-bit). Other versions may work as well. Regardless of the Ubuntu version, our testing suggests that Bluetooth LE support works best with Linux kernel version >= 3.5.
$ sudo apt-get install cmake \
curl \
git \
g++ \
libreadline-dev \
libglib2.0-dev \
$ cd ~/anki
$ git clone https://github.com/anki/drive-sdk.git
$ cd drive-sdk
$ mkdir -p build && cd build
$ cmake .. -DBUILD_EXAMPLES=ON
$ make
$ make test
$ make install
-
Obtain a suitable USB Bluetooth adapter like the Orico BTA-402
-
Plug in the adapter and verify it is properly loaded by using lsusb
$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
-
Enable the adapter with hciconfig (included with drive-sdk)
$ sudo ~/anki/drive-sdk/build/dist/bin/hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 00:02:5B:03:52:F3 ACL MTU: 310:10 SCO MTU: 64:8 DOWN RX bytes:473 acl:0 sco:0 events:19 errors:0 TX bytes:317 acl:0 sco:0 commands:18 errors:0 $ sudo ~/anki/drive-sdk/build/dist/bin/hciconfig hci0 up $ sudo ~/anki/drive-sdk/build/dist/bin/hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 00:02:5B:03:52:F3 ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING RX bytes:940 acl:0 sco:0 events:37 errors:0 TX bytes:634 acl:0 sco:0 commands:36 errors:0
Pull out Boson and Kourai from the Anki Drive Starter Kit and turn them on by pressing the little button on the bottom of each car.
-
Scan for them with the vehicle-scan example app
$ sudo ~/anki/drive-sdk/build/dist/bin/vehicle-scan LE Scan ... DF:FA:7F:89:61:D2 Drive [v2120] (Boson 1e00) F0:9C:17:98:F8:E8 Drive [v2120] (Kourai 10b3)
-
Make Boson's tail light flash a pattern with the vehicle-tool example app
$ sudo ~/anki/drive-sdk/build/dist/bin/vehicle-tool --adapter=hci0 --device=DF:FA:7F:89:61:D2 [DF:FA:7F:89:61:D2][LE]> connect Attempting to connect to DF:FA:7F:89:61:D2 Connection successful Starting handle: 0x0009 Ending handle: 0xffff [handle: 0x000a, char properties: 0x0e, char value handle: 0x000b] [handle: 0x000c, char properties: 0x12, char value handle: 0x000d] [DF:FA:7F:89:61:D2][LE]> get-version [read] VERSION_RESPONSE: 0x2120 [DF:FA:7F:89:61:D2][LE]> ping [read] PING_RESPONSE [DF:FA:7F:89:61:D2][LE]> set-lights-pattern TAIL FLASH 1 6 10 [DF:FA:7F:89:61:D2][LE]> vehicle-disconnect [DF:FA:7F:89:61:D2][LE]> exit