cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 4

Anonymous
Not applicable

Hello,

I followed the available tutorial and used the PSoC BLE and Android code available at GitHub - cypresssemiconductorco/bleapp.

In the BLE100 app, I'm able to turn on/off the red LED, but the Capsense is not working. When I enable "Notify" the "Capsense value" becomes "No Touch", but the app doesn't show values when I slide the finger in the sensor. However, the Capsense works with the Cysmart app.

The only changes I made were in the PSoCCapSenseLedService.java file, to be able to search for devices and discover services and characteristics.

What can be the problem?

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator

Hello Jose,

I checked by running the Github Source code and by changing the UUIDs as provided by PSoC Creator. Yes, what you said is true, the LED works, but the Capsense Values aren't getting updated. I checked the code and here is the solution. Change the following function in PSoCCapSenseLedService.java file:

@Override
  public void onCharacteristicChanged(BluetoothGatt gatt,

  BluetoothGattCharacteristic characteristic) {

  String uuid = characteristic.getUuid().toString();

  System.out.println(uuid);

// In this case, the only notification the apps gets is the CapSense value.
  // If the application had additional notifications we could
  // use a switch statement here to operate on each one separately.

if(uuid.equalsIgnoreCase(capsenseCharacteristicUUID)) {
mCapSenseValue = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_SINT16,0).toString();
}


  // Notify the main activity that new data is available
  broadcastUpdate(ACTION_DATA_RECEIVED);

  }

So the UUID stored on GATT Database is converted to lower case and the one you provide in the java code if it is in upper case, the .equals() function returns false and hence it doesn't enter the if condition and update the capsense value. Just change .equals() to .equalsIgnoreCase() as highlighted in bold and it will work.

Regards,

Dheeraj

View solution in original post

0 Likes
5 Replies