GithubHelp home page GithubHelp logo

blemotion's Introduction

BLEMotion

An example iOS app that uses CoreBluetooth to send CoreMotion data to another iOS device via BLE

In order to send data from one iOS device to another, this app make use of both the peripheral mode and central mode of CoreBluetooth. Peripheral mode is what we commonly think of for a peripheral like headphones, heart rate monitor, or a fit bit. It's a device that is publishing BLE services for a central device to consume. Central mode is what we commonly associate with an iPhone or computer - using a device to connect to an interact with peripherals.

iOS supports operating as both a peripheral and central. It is most common for iOS apps to implement the central role, but for this app I have implemented both the peripheral and central roles. The peripheral role will be used for the iOS device that is publishing it's core motion information for pitch, roll and yaw. The application will provide the data on a single characteristic that is part of an exposed service. The central roll will be filled by the app instance that will connect to the peripheral and read the Core Motion values that are being provided on the BLE service.

Install

Install this app on two iOS devices in order to use the BLE functionality between devices. Set one of the devices into peripheral mode and then connect to the peripheral from the device acting in the central role.

Peripheral Mode

After starting the app, simply check the box on the main screen to begin sending Core Motion data from the device to the BLE service and characteristic.

Central Mode

On a device that is not operating as a peripheral, navigate to the Peripheral List. This list should show the nearby Peripheral device. Make sure the app instance operating as a peripheral is started and in the foreground. Tap on the peripheral instance in the list to connect to the device. Once connected, the device details screen will show a real time update of the Euler Angles that are being sent on the BLE service.

Visualize

Once connected to a peripheral, you can more easily visualize the data by tapping the "Visualize" button on the peripheral details screen to be taken to a visualization. Here, I've used a simple 3D rendering of a rectangle that corresponds to the iOS device providing CoreMotion data. As you move the device around, you'll see the on screen box move around as well. Keep in mind that the angles are oriented with reference to magnetic north, so facing west generally gives a consistent feel between the iOS device being manipulated and the on screen visualization.

blemotion's People

Contributors

welbesw avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.