Sphero/bb8 programming

Hi, my kids have gotten a Sphero and bb8 for Xmas. There’s a few ways to program these devices - but all of them using a version of ‘scratch’ (which is a frustrating way to program). Would love if there was a way to program them using codea.

Those names are new to the forum, so I don’t like your chances of getting a solution. Can you control the devices from iOS?

Hah! yeah, I figured it’s a real long shot, but - as I suspect programming robots is where education is going for programming (it’s far easier to get kids engaged in coding when they can see a real robot run around doing the code they’ve programmed) I thought I could flag it up nice and early that in two or three years I can sit back and smugly say “I KNEW this would be big”

They both have dedicated iOS apps (which have a certain level of functionality. But not programming) but they also have developer APIs which is being used by a variety of scratch like drag and drop programming languages (Tynker, Tickle, SPRK Lightning Lab - to name three) but I find scratch frustrating and pretty limited (plus these seem to start from the basis of being languages for coding an API rather than a full featured language that is hooked in to an API)

There are more than just two robots - these are just the two my kids have, but I absolutely appreciate it’s a big ask :slight_smile: this was as much about finding out if others are using them (and whether they’ve figured out other ways to control them via codea) as anything else…

9Btw: Sphero and BB8 both enormous fun!)

I suspect iOS is so thoroughly sandboxed, there is no chance…

Do any of the apps allow for external apps to control them? If they have URL schema, that could be one option.

I maybe I wasn’t clear: the other programming languages are all iOS, so they’re using the Sphero API(maybe I’m using the wrong word here? The developer library?) to hook directly to the Sphero in order to control from an iPad. I’m not saying it’s a matter of dropping an API into codea but it’s not an impossibility to program them from iPads/codea)

There’s some weird specific way that an app hooks to a Sphero or other device that means you can’t use them in the background, so suspect that would rule out external app control.

the Apple policy is to isolate totally any app in a ‘sandbox’. So you cant do anything from codea towards another app. Exceptions:

  • access other apps via web http request.
  • or via web ‘sockets’.
    check if your robot has such inputs

Or, via URL schemes. Some apps have very developed URL schemes (there is one standard called X-callback URL which allows for apps to deliver instruction sets to each other). Codea can then control these apps by issuing openURL commands. I use this to control the Working Copy Git app. (Eg I issue a command from Codea that says “start the WebDAV server and then return to Codea”). For things like sphero, the other app I imagine would have to be running in the background. I find that on an iPad Air with iOS 9, other apps can run continuous processes in the background for several minutes at a time. Eg Working Copy runs a WebDAV server in the background that I access from Codea. It all depends on the extent to which the sphero app creators intend for it to be connected to other apps. The other possibility is to see if you can use third party iOS automation apps like Workflow (so workflow operates the sphero app, and workflow in turn is operated by Codea)

The Sphero SDK seems fairly easy to integrate. I imagine it connects over Bluetooth or Wi-Fi.

Just had a look at the docs, http://sdk.sphero.com/sdk-documentation/basic-commands/

We could design a Codea API around their Objective-C API. I’ll have to give it some thought.

Well that’s much more than I could have hoped for! Fingers crossed it’s a) easy and b)worth the effort!

@Simeon Hopefully that would mean a bluetooth library that Codea could access. That would open up not only Sphero but also allow communication between Arduino and Raspberry PI devices and could open up Codea to a whole new bunch of hobbyist programmers.