Can't write to characteristic from iPhone

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
PaDo_1228851
Level 3
Level 3
25 replies posted 10 replies posted 10 questions asked

Hello,

   

I cannot change a characteristic on a 4200BLE using my iPhone 5.  Here is the xcode running on my iPhone:

   

____________________________

   

let data: String = newAlarmValue.text! //this is coming from an xcode text field.

   

        let value = data.dataUsingEncoding(NSUTF8StringEncoding)

   

        print(value!)

   

        print(alarmValueCharacteristic!) //the alarmValueCharateristic type on the 4200BLE is UInt8

   

        selectedPeripheral!.writeValue(value!, forCharacteristic: alarmValueCharacteristic!, type: CBCharacteristicWriteType.WithoutResponse)

   

_______________________________

   

I print characteristic and value in my console to check I am writing to the right characteristic.  I can change the value in the characteristic with the PSoC Creator interface and confirm the change has occurred in the xcode console.  But I can't get the characteristic value to change over the air.  

   

Do I need to do something in the event hanlder in main.c?

   

Thanks,

   

Pat

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

   

Are you able to write the charactertis value using a CySmart iOS App or CySmart PC Tool? If so, the problem might be with your iOS Code.

   

If not, please check if the "write" property is selected in the Profile Settings in the BLE Component Window.

   

Regards,

   

- Madhu Sudhan

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

   

Are you able to write the charactertis value using a CySmart iOS App or CySmart PC Tool? If so, the problem might be with your iOS Code.

   

If not, please check if the "write" property is selected in the Profile Settings in the BLE Component Window.

   

Regards,

   

- Madhu Sudhan

0 Likes