Servo library support (#1343)
* ateempt at bringin servos * basic plumbing * avoid math map duplicate * missing parts annontation * pretify parts * extend appcompat layer * updated strings * more compat layer * annotations * don't rely on webmidi * updated pxt ref * bump pxt * adding whenUsed * updated v1 readme * more pins * more pins * compress the parts definition * update common packages
This commit is contained in:
@ -13,7 +13,7 @@ namespace pins {
|
||||
* @param toHigh the upper bound of the value's target range, eg: 4
|
||||
*/
|
||||
//% help=pins/map weight=23
|
||||
//% blockId=math_map block="map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh"
|
||||
//% blockId=pin_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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user