BLE cadence characteristic parsing iOS bluetooth Swift
I am trying to create an iOS app that reads a cadence sensor (Wahoo fitness cadence). This is bluetooth characteristic 0x2A5B (CSC Measurement). In this example, cadence is how fast the pedals rotate on a bike. I am using the code below in Swift to read the characteristic from the sensor: Version 1: private func cadence(from characteristic: CBCharacteristic) -> Int { guard let characteristicData = characteristic.value else {return -1 } let byteArray = [UInt8](characteristicData) print(byteArray) let firstBitValue = byteArray[1] & 0x01 //set bit 1 (not 0) if firstBitValue == 1 { //IF crank revo
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.