Swift : Merge multiple readings on system time
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
span.s1 {color: #272ad8}
span.s2 {color: #ba2da2}
span.s3 {color: #d12f1b}
device.accelerometer?.sampleFrequency = 50;
device.accelerometer?.dataReadyEvent.startNotificationsAsync(handler: { (obj, error) in
if let obj = obj {
let myData = "\(obj.x)," + "\(obj.y)," + "\(obj.z)," + self.self.formatter.string(from: Date()) + ",\(self.totalAccelSample)";
// do something with the data
}
});
I am aware that I can do the same for reading the gyro data. However, I cannot figure out how to get both the accelerometer and gyro readings *at the same time*. I understand that the method I am calling above behaves in the way of "when you have data, send it to me". However, I'd rather "poll" for all data I am interested in at once, as opposed to "waiting" for it. Is it possible to poll the accelerometer and gyro data at will?
Comments