adding pins.pulseIn API

This commit is contained in:
Peli de Halleux
2016-08-17 11:18:15 -07:00
parent 269254796d
commit 8e811b913e
8 changed files with 108 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ namespace pins {
* @param toLow the lower bound of the value's target range
* @param toHigh the upper bound of the value's target range, eg: 4
*/
//% help=pins/map weight=22
//% help=pins/map weight=23
//% blockId=math_map block="map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh"
export function map(value: number, fromLow: number, fromHigh: number, toLow: number, toHigh: number): number {
return ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow;