readButtonValue(id)
Get the state of the touch sensor
Parameter
Parameters
Type
Description
id
unsigned char
ID number to be controlled, range 0 ~ 10
Return Values
Parameters
Type
Description
number
int
State of touch sensor:
1 – Single press
2 – Double press
3 – Long press
Example
Use the uKit Explore v2 board to read the state of the touch sensor. When single press, set the on-board LED to RED for 400ms. When double press, set the on-board LED to GREEN for 400ms. When long press, set the on-board LED to BLUE for 400ms. The on-board LED is off when not press.
Last updated