adding waitUntil to buttons

This commit is contained in:
Peli de Halleux
2017-11-30 10:05:00 -08:00
parent 305a650125
commit a92edcffee
6 changed files with 34 additions and 0 deletions

View File

@ -51,6 +51,21 @@ namespace sensors {
this.button.onEvent(<ButtonEvent><number>ev, body)
}
/**
* Wait until the touch sensor is touched
* @param sensor the touch sensor that needs to be clicked or used
* @param event the kind of button gesture that needs to be detected
*/
//% help=input/touch-sensor/wait-until
//% blockId=touchWaitUntil block="wait until `icons.touchSensor` %sensor|%event"
//% parts="touch"
//% blockNamespace=sensors
//% weight=98 blockGap=8
//% group="Touch Sensor"
waitUntil(ev: TouchSensorEvent) {
this.button.waitUntil(<ButtonEvent><number>ev);
}
/**
* Check if touch sensor is touched.
* @param sensor the port to query the request