setEioMode()


Description

This function sets a type of a digital input port.

Syntax

step.setEioMode(id, mode)

Parameters

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

mode description
0 normal input
otherwise control lock

Returns

none

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.setVrefStop(2);
    step.setVrefDrive(8);
    step.setVrefLock(8);
    step.setSpeed(400);
    step.setAccel(4000);

    step.setEioMode(0, 1);
    step.setEioMode(1, 1);
    step.setEioMode(2, 1);
    step.setEioMode(3, 1);

    step.stepGoto(4000);

    while(step.getState() > 1) {
        delay(1);
    }

    // state: 0 - stop, 1 - locked
    Serial.print("step_state ");
    Serial.println(step.getState());

    step.unlock();

    // state: 0 - stop, 1 - locked
    Serial.print("step_state ");
    Serial.println(step.getState());
}

void loop() {

}