The main problem seems to be that the data, even if sampled at 100Hz, is sent to the iPhone only every second or so. There are certainly any things that can and should be improved. In the drop down menu we can choose three out of all sensors. This gives a user interface which looks like this: We also need to define a streaming function: stream := Refresh], ","]] & Select], Head = List &], UpdateInterval -> 0.01]Īlright. Switch the streaming on and execute the following commands: ClearAll įor], 0.01] Now we are ready to connect to the iPhone. The following Mathematica code will work when all (!) sensors are switched on. In fact we also can choose which sensors we want to use with the Config button. There you can choose a frequency for the measurements and start the streaming. If you click on the respective button on the bottom you get to a screen like this: In this post we are rather interested in the "Streaming" function. If you click on the "start capture" the iPhone's data will be stored on the phone and can be downloaded into Mathematica. These numbers will be important to connect to the phone and either download data or stream sensor data directly. When you open the app you see a screen like this one.Īt the top of the screen you see an IP address and a port number (after the colon!). The first thing we need in order to be able to read the iPhone is a little App which can be purchased on the iTunes App store: it is called Sensor Data. Björn Schelter and myself have worked on this together. For this post, I will be using an iPhone 5 - but a similar approach can be taken with many other smart phones. Smart phones, on the other hand, are our permanent companions and they host a wide array of sensors that we can tap into with Mathematica. In most of the cases, when we speak about connected devices, additional hardware is necessary. Connecting Mathematica to an Arduino for example allows you to read and then work with data from all kinds of sensors. Many fantastic posts in this community describe how to connect external devices to Mathematica and how to read the data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |