2016-04-05 15:59:25 -07:00
|
|
|
/**
|
|
|
|
* Events and data from sensors
|
|
|
|
*/
|
2017-01-05 07:01:50 -08:00
|
|
|
//% color=#B4009E weight=99 icon="\uf192"
|
2016-03-10 14:01:04 -08:00
|
|
|
namespace input {
|
|
|
|
/**
|
|
|
|
* Attaches code to run when the screen is facing up.
|
|
|
|
* @param body TODO
|
|
|
|
*/
|
2016-03-21 22:13:39 -07:00
|
|
|
//% help=input/on-screen-up
|
2016-03-10 14:01:04 -08:00
|
|
|
export function onScreenUp(body: Action): void {
|
2016-03-24 08:26:55 -07:00
|
|
|
onGesture(Gesture.ScreenUp, body);
|
2016-03-10 14:01:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attaches code to run when the screen is facing down.
|
|
|
|
* @param body TODO
|
|
|
|
*/
|
2016-03-21 22:13:39 -07:00
|
|
|
//% help=input/on-screen-down
|
2016-03-10 14:01:04 -08:00
|
|
|
export function onScreenDown(body: Action): void {
|
2016-03-24 08:26:55 -07:00
|
|
|
onGesture(Gesture.ScreenDown, body);
|
2016-03-10 14:01:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attaches code to run when the device is shaken.
|
|
|
|
* @param body TODO
|
|
|
|
*/
|
2016-03-21 22:13:39 -07:00
|
|
|
//% help=input/on-shake
|
2016-03-10 14:01:04 -08:00
|
|
|
export function onShake(body: Action): void {
|
2016-03-24 08:26:55 -07:00
|
|
|
onGesture(Gesture.Shake, body);
|
2016-03-10 14:01:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attaches code to run when the logo is oriented upwards and the board is vertical.
|
|
|
|
* @param body TODO
|
|
|
|
*/
|
2016-03-21 22:13:39 -07:00
|
|
|
//% help=input/on-logo-up
|
2016-03-10 14:01:04 -08:00
|
|
|
export function onLogoUp(body: Action): void {
|
2016-03-24 08:26:55 -07:00
|
|
|
onGesture(Gesture.LogoUp, body);
|
2016-03-10 14:01:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attaches code to run when the logo is oriented downwards and the board is vertical.
|
|
|
|
* @param body TODO
|
|
|
|
*/
|
2016-03-21 22:13:39 -07:00
|
|
|
//% help=input/on-logo-down
|
2016-03-10 14:01:04 -08:00
|
|
|
export function onLogoDown(body: Action): void {
|
2016-03-24 08:26:55 -07:00
|
|
|
onGesture(Gesture.LogoDown, body);
|
2016-03-10 14:01:04 -08:00
|
|
|
}
|
|
|
|
}
|