setDelay()


Description

This function sets the valid time for the judgment of the input signal.

Syntax

input.setDlay(ms)

Parameters

ms - valid time in millisecond unit (1 ~ 30000)

Returns

none

Example

#include <PhpocExpansion.h>
#include <Phpoc.h>

byte spcId = 1;

ExpansionPhotoInput input0(spcId, 0);
ExpansionPhotoInput input1(spcId, 1);
ExpansionPhotoInput input2(spcId, 2);
ExpansionPhotoInput input3(spcId, 3);

void setup() {
    Serial.begin(9600);
    while(!Serial)
        ;

    Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
    Expansion.begin();

    input0.setDelay(1000);
    input1.setDelay(1000);
    input2.setDelay(1000);
    input3.setDelay(1000);

    Serial.println(input0.getPID());
    Serial.println(input0.getName());
}

void loop() {
    if(input0.isOn())
        Serial.println("Port 0: 1");
    else
        Serial.println("Port 0: 0");

    if(input1.isOn())
        Serial.println("Port 1: 1");
    else
        Serial.println("Port 1: 0");

    if(input2.isOff())
        Serial.println("Port 2: 0");
    else
        Serial.println("Port 2: 1");

    if(input3.isOff())
        Serial.println("Port 3: 0");
    else
        Serial.println("Port 3: 1");

    Serial.println();

    delay(1000);
}