MetaWear Magnetometer Code (Swift)
device.gyro?.dataReadyEvent.startNotificationsWithHandlerAsync { (obj, error) in
//print(obj)
}.success { result in
print("Successfully subscribed")
}.failure { error in
print("Error on subscribe: \(error)")
}
device.magnetometer?.dataReadyEvent.startNotificationsWithHandlerAsync { (obj, error) in
//print(obj)
}.success { result in
print("Successfully subscribed")
}.failure { error in
print("Error on subscribe: \(error)")
}
Using this code, I'm able to get the data for Gyro, but not for Magnetometer. I'm getting the following error "value of type MBLMagnetometer has no member 'dataReadyEvent'".
How to get the data for magnetometer?
Comments
print(result)
})
device.magnetometer?.magneticField?.periodicReadWithPeriod(1).startNotificationsWithHandlerAsync { obj in
print("magnetometer data")
print(obj)
}.success{result in
print("Magno successfully subscribed")
}