Office Hours Q&A With Pebble Developer Evangelist
This article is based on the Codementor Office Hours hosted by Thomas Sarlandie, a developer evangelist working at Pebble. It answers questions such as how to efficiently handle debugging, how to handle floating point numbers and math in Pebble, and other questions the audience asked.
Is data visualization down the road with Pebble?
Yes, a lot of apps do data visualization, and there are many definitions to what data visualization is or could be. If you look at apps on the Pebble app store, you’ll find apps that connect to different web services like google analytics and other services that aggregate data for you. If you search for data visualization you’ll likely find a few apps.
How to deal with floats and math efficiently on Pebble watches
As the CPU on pebble does not have a floating point unit, it cannot use hardware acceleration on floating point numbers. However, there are two ways to deal with this, and they both evolve around using fixed points than floating points. Fixed-point math is when you know how many digits you have on your data. For example, if you only care about the last three 3 digits, you can multiply your number by 1000 after the digital separator. Or, if you look at how angles are handled on Pebble, you’d notice there’s a function like the compass that will give you a heading. Instead of taking a value between 0 and 360, it will take the value of 0 and 10,000, and you divide 10,000 by 360 to get the value of 1 degree. So that’s a general idea of how to do fixed point.
If you actually have a requirement for more precise math, for example to do some signal processing to process accelerometer data and count the user steps you can use a fixed point library that will replace the default floating point implementation in the compiler. If you want more details on this we have a presentation on pebble developer’s site in 2014 with a section on size, and it covers different ways of optimizing you app for floating points. In there we have an example of how to use a fixed point, which is also available on Github.
Is there a mechanism for the watch to dial 911 on the phone even without SIM?
Because of the way iOS is designed, Pebble cannot dial directly on the phone because it could create incurred cost for the user, so iOS does not allow Pebble to dial to the phone. However, you can do this on Android, but then it will be an Android-only app and not work on iOS. It will, however, work without a SIM card.
How to log for debugging purposes when in an event-driven loop
When you deploy an app on Cloud Pebble, you can view the app logs and you can see some debugging information in the logs.
Is it possible to record a reminder message with a push of the button?
Pebble does not have a built-in microphone, but something that works really well is having an iOS or Android app talk to pebble, and when you press a button on your pebble, you send a message to your iOS app and the iOS app uses the phone’s microphone to record. It works very well because most of the time the phone is not far away at all from pebble. There have been use-cases where you press a button and your Pebble tells your phone to record 30 seconds for music recognition, and then afterwards it sends you a reply to your watch.
In terms of hardware, is there any plan to include possibility of measuring body metrics e.g. pulse as S5 can do?
Not in pebble, but if you want to explore that type of app, I can recommend you get in touch in me via thomas[at]getpebble[dot]com, and I’ll send you the Bluetooth Smart SDK that will allow your pebble app to connect to BLE accessories. There are a lot of body sensors available with BLE APIs for different body metrics, so you can get heart rate, respiration volume and other information through those Bluetooth smart accessories. Also, if your athletes are on bikes, there are great bike accessories that will allow data to be transferred via Bluetooth. In this case, your pebble will sit on your wrist, connect to those accessories, get the information, and display the stats. It can also let the user know when they’re starting a new run/sprint, and once you process the information you can save it in on the mobile apps.
Other Posts Based on this Office Hour:
Thomas Sarlandie is a mobile developer who has written some of the most popular french iOS apps such as LeMonde.fr and SNCF apps, and he has also written a book on iOS development before. Thomas currently works as a developer evangelist for Pebble. You can use the Codementor coupon to buy Pebble with a $20 discount, and it will be valid for the first 200 developers to claim it.
Or Become a Codementor!