I have the following code in my app, which reads a single byte send from a peripheral. I now want to read 20 bytes sent together from the peripheral. How do I change the swift code?
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
u16 = UInt8((characteristic.value! as NSData).bytes.bindMemory(to: Int.self, capacity: characteristic.value!.count).pointee)// get input ascii value //
let chart = Character(UnicodeScalar(u16))// make into a character //
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
Code Block var u16: UInt8
u16 = UInt8((characteristic.value! as NSData).bytes.bindMemory(to: Int.self, capacity: characteristic.value!.count).pointee)// get input ascii value //
let chart = Character(UnicodeScalar(u16))// make into a character //