danielweber90 / MiBand-for-Swift

A simple application to show how to use basic features of the Xiaomi Mi-Band 2 with Swift
26 stars 3 forks source link

Continuously heart rate ? #2

Open dx777 opened 7 years ago

dx777 commented 7 years ago

Hi Daniel, Thank you for your awesome project. Can you kindly tell me, if there's a way to continuously measure a heart rate ? Not only by tapping on a button.

Waiting for your reply, thank you.

danielweber90 commented 7 years ago

Hey, As far as I know there is no way to tell your mi band that it should measure your heart rate constantly. At least I couldn't find anything about it. The only way I could think of to achieve this, is to create a new timer everytime a heart rate value is received.

Timer(timeInterval: 60, repeats: false, block: {_ in self.miBand.measureHeartRate()})

Actually it's a pretty good point you make! I will test this and add it as a feature if it works properly.

Thanks for that hint!

Best regards, Daniel

dx777 commented 7 years ago

Thank you for your quick reply,

Also, there's a Real time step counter, in the discription of your project, how do i trigger that ?

Steps counter is not updating, right from the box.

Thank you.

dx777 commented 7 years ago

Daniel, please reply, how do i update steps qty ?

creative-cranels commented 6 years ago

Hi @dx777! Did you find the answer for your question?) I am also trying to get accelerometer information, but don't know how yet.

dx777 commented 6 years ago

@kayoshi Hi, which one ? There's no way to continuously read hert data, only once in a 7-10 seconds. About the realtime step counter you need to subscribe to notifications, in didDiscoverCharacteristicsFor method, like this: case MiBand2Service.UUID_CHARACTERISTIC_7_REALTIME_STEPS.uuidString: peripheral.setNotifyValue(true, for: cc) self.updateSteps()

I think author forgot to do that

creative-cranels commented 6 years ago

thanks @dx777 , currently I am trying to work with accelerometer but don't know how to read it in realtime.