3 Replies Latest reply on Aug 1, 2017 8:28 AM by e.pratt_1639216

    Read a digital input pin then write it's value to a characteristic?


      The code immediately below works fine.  The value "5"  is successfully written to the characteristic:


      uint8 tilt_0 = 5;


      tilt_0_Handle.attrHandle = CYBLE_MYSERVICE_TILT_0_CHAR_HANDLE;


      tilt_0_Handle.attrHandle.value.val = (uint8 *)&tilt_0;


      tilt_0_Handle.attrHandle.value.len = 1;


      CyBle_GattsWriteAttributeValue(&tilt_0_Handle, 0, NULL, CYBLE_GATT_DB_LOCALLY_INITITATED);




      But when the following substitution is made for the value "5" in the first line, the value of the pin (which can be either 1 or 0) is not written to the characteristic:


      uint8 tilt_0 = MyDigitalInputPin_Read();


      I've also tried writing the output values from the scanning comparator with no success.


      Am I using the wrong data type for the pin read?