GithubHelp home page GithubHelp logo

sphero-bluemix-ios's Introduction

sphero-bluemix-ios

This project is an iOS app that demonstrates how to steer a Sphero ball via URL commands using IBM Bluemix, the MQTT protocol and the IBM Internet of Things service. Watch the videos to learn more.

For the communication between the iOS app and the ball over bluetooth the Sphero iOS SDK is used. Since the SDK is not available under an open source license two directories need to be downloaded and copied into the iOS project.

For the communication between the iOS app and IBM Bluemix the IBM WebSphere iOS MQTT Client is used which needs to be downloaded and copied into the iOS project as well.

Authors: Mike Robertson, Bryan Boyd

Setting up the iOS Project

After importing the dependencies and opening the project in Xcode, you should have the following project structure.

Download the Sphero iOS SDK and extract it. Copy the following two folders into the root of your iOS project.

To import the MQTT client library download the package and extract it. Make sure you select and download the refresh pack "1.0.0.4-WS-MQCP-MA9B.zip". From the zip file import the following two files into the Chariot folder.

  • libiosMQTT.a
  • MqttOCClient.h

Setup of the Bluemix Application and the Node-RED Flow

In order to send commands to the iOS app a Node-RED flow in IBM Bluemix is used in combination with the IBM Internet of Things Foundation.

Log in to Bluemix and create a new application, e.g. MySphero, based on the Internet of Things Foundation Starter. Additionally add the Internet of Things service to it.

In the next step you have to register your own device. Open the dashboard of the Internet of Things service and navigate to 'Add Device'. As device type choose 'and' and an unique device id - screenshot. As result you'll get an org id and password - screenshot.

In order to import the flow open your newly created Bluemix application and open the Node-RED editor, e.g. http://mysphero.mybluemix.net/red, and choose [import from clipboard]((https://raw.githubusercontent.com/IBM-Bluemix/sphero-bluemix-android/master/images/nodered4.png). You find the flow (flow.txt) in the sub-directory 'noderedflow'. In the outgoing IoT node select your unique device id and deploy the application.

Run the iOS App and invoke URLs

Before running the app you need to enter the Internet of Things configuration from the previous step in the iOS app. You can either do this in the UI of the app or directly in the source code. If you don’t want to modify the source code you can enter your configuration in the app’s welcome screen. Alternatively you can define the values of your org id, the unique id and the password in the file LoginViewController.m.

The app can not be run via the emulator but only via actual iOS devices. Before you can do this you need to sign the app. Also make sure that both Wifi and Bluetooth are enabled.

After this you can see the connected device in the IoT dashboard. You can now invoke the following URL commands to steer the Sphero ball.

alt text

sphero-bluemix-ios's People

Contributors

nheidloff 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.