Hierarchy

Constructors

Properties

Obniz: Obniz

obniz to be used

timeout: number = ...

Rsponse waiting timeout in milliseconds

prefixed: string | boolean

Methods

  • io animation is used when you wish to accelerate the serial sequence change of io.

    "Loop" animation can be used. io changes repeatedly in a sequential manner according to json array. io and pwm json commands can only be used.

    obnizOS ver >= 2.0.0 required.

    //javascript
    // Javascript Example
    obniz.io.animation("animation-1", "loop", [
    {
    duration: 10,
    state: function(index){ // index = 0
    obniz.io0.output(false)
    obniz.io1.output(true)
    }
    },{
    duration: 10,
    state: function(index){ // index = 1
    obniz.io0.output(true)
    obniz.io1.output(false)
    }
    }
    ])

    It will generate signals likes below

    • Remove animation
    obniz.io.animation("animation-1", "loop")
    
    • Pause animation
    obniz.io.animation("animation-1", "pause")
    
    • Resume paused animation
    obniz.io.animation("animation-1", "resume")
    

    Parameters

    • name: string

      name of animation

    • status: AnimationStatus

      status of animation

    • Optional animations: DirectiveAnimationFrame[]

      instructions. This is optional when status is pause``resume.

    • Optional repeat: number

      The number of repeat count of animation. If not specified, it repeat endless.

    Returns void

  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string
    • Rest ...args: any[]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns string[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: string

    Returns number

  • Return the listeners registered for a given event.

    Parameters

    • event: string

    Returns ListenerFn[]

  • Parameters

    • event: string
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Directive

  • Add a listener for a given event.

    Parameters

    • event: string
    • fn: ListenerFn
    • Optional context: any

    Returns Directive

  • Add a one-time listener for a given event.

    Parameters

    • event: string
    • fn: ListenerFn
    • Optional context: any

    Returns Directive

  • Remove the listeners of a given event.

    Parameters

    • event: string
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Directive

  • It start io aniomation with limited repeat count. And It wait until done.

    // Javascript Example
    await obniz.io.repeatWait([
    {
    duration: 1000,
    state: function(index){
    obniz.io0.output(true)
    }
    },{
    duration: 1000,
    state: function(index){
    obniz.io0.output(false)
    }
    }
    ], 4)

    Parameters

    Returns Promise<unknown>

Generated using TypeDoc