digitalPulse() short pulse length

Posted on
  • In the documentation, it says:

    digitalPulse is for SHORT pulses that need to be very accurate. If
    you're doing anything over a few milliseconds, use setTimeout instead.

    How many milliseconds is too many milliseconds?

  • I'd say 1000ms is a good start.

    It's not a hard limit at all and there are times you might want to use more, but:

    • digitalPulse is asyncronous - other code will keep executing while it pulses the pin
    • When it's running, Espruino can't enter 'deep sleep' modes, so will use more power
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

digitalPulse() short pulse length

Posted by Avatar for chustar @chustar