UNPKG

openi2c

Version:

This library is a set of cross platform drivers for common I2C devices.

8 lines (7 loc) 301 B
export async function sleep(ms:number) { return new Promise(resolve => setTimeout(resolve, ms)); } export function mapValue(current: number, inMin = 0, inMax = 1, outMin = 0, outMax = 1) { const mapped = ((current - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin; return mapped; }