iphone - hm-10 to iOS via Bluetooth -


i develop app sending , receiving between arduino , iphone via ble

i doing code.

func peripheral(_ peripheral: cbperipheral, diddiscovercharacteristicsfor service: cbservice, error: error?) {     print("\(service)")     if let characterarray = service.characteristics [cbcharacteristic]!{         cc in characterarray{              if(cc.uuid.uuidstring == "ffe1"){                 print("connect")                 peripheral.readvalue(for: cc)             }         }     } }    func peripheral(_ peripheral: cbperipheral, didupdatevaluefor characteristic: cbcharacteristic, error: error?) {      print("\(characteristic)")      let text = "hello world"     let senddata = text.data(using: .utf8)!     peripheral.writevalue(senddata,  for: characteristic, type: cbcharacteristicwritetype.withoutresponse)      print("\(characteristic.uuid.uuidstring)")     if (characteristic.uuid.uuidstring == "ffe1"){         let value = characteristic.value!.withunsafebytes { (pointer: unsafepointer<int>) -> int in             return pointer.pointee         }     print("xx \(value)")      } } 

on serial monitor (arduino), can receive data iphone when type on serial monitor , send it. nothing changes on xcode debugger

xcode debugger

serial monitor


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -