getEio()


Description

This function gets a status code of a digital input port.

Syntax

state = step.getEio(id)

Parameters

id - a integer value which represents the port number of a limit switch (0 ~ 3)

※ pps: pulse per second

Returns

a integer value represents the status of a digital input port

status code description
0 low
1 high (default)

Example

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

byte spcId = 1;

ExpansionStepper step(spcId);

int state;

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

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

    Serial.println(step.getPID());
    Serial.println(step.getName());

    step.setMode(4);
    step.setVrefDrive(8);
    step.setSpeed(400);
    step.setAccel(1000);

    step.stepGoto(40000);
}

void loop() {
    state = step.getEio(0);

    if(state == 0)
        step.stop();

    delay(1);
}