I wrote an iOS app that sends the value of a UISlider to the spark which that value controls the speed of a motor. It works pretty good but it can be a little sluggish at times. What happens is if I move the slider to fast the spark stops responding. What I’m wondering is what are the limitations of sending commands to the spark?
There are no specific rate limits on the API right now, but there will be soon. If you send API requests too quickly, you just see them queue up so the response seems sluggish. The Right Way™ to do this is to rate limit your requests in the iOS app. When you send the value of the UISlider to the Spark API, get the current time, and only send another request if it’s been more than, say, half a second since you sent one.
Also, if you’re doing this locally—as in, you’re near the Core and can see the motor being driven—take a look at the local communication annotated example. You’ll get a much faster response if you don’t have to go through the Cloud!