Hoping to get some help. Using swift3 and xcode 9.3.
I can write data from iPhone back to nrf52 peripheral fine if it is a Dbl.
When I try to write a UInt16, it crashes.
Here is the code that works for Dbl:
row = 10 let bytes : [UInt8] = [Uint8(row)] let data = Data(bytes:bytes) self.bluetoothManager.connectedPeripheral?.writeValue(data, for: self.rowCharacteristic!, type: CBCharacteristicWriteType.withResponse)
Here is my code I tried for UInt16 (reading is UInt16):
reading = 8855 let bytes : [UInt8] = [Uint16(reading)] let data = Data(bytes:bytes) self.bluetoothManager.connectedPeripheral?.writeValue(data, for: self.rowCharacteristic!, type: CBCharacteristicWriteType.withResponse)
Thank you