import { Pin, setMode, PinMode, setDigital, HIGH, LOW } from '@embedito95/gpio' import { sleep } from '@embedito95/async' // Two `await sleep` sites in one function reuse the single inlined timer pair // (`childSleepMilliseconds`/`childSleepStart`) because they run sequentially. const pulse = async () => { for (let index: u8 = 0; index < 2; index += 1) { setDigital(Pin.10, HIGH) await sleep(10) setDigital(Pin.10, LOW) await sleep(20) } } const setup = () => { setMode(Pin.10, PinMode.OUTPUT) } const main = () => { setup() pulse() } main()