I want to find...

Search

Shares

Table of Content

EthercatDevice_DmpDIQ.digitalRead()

[EthercatDevice_DmpDIQ_Generic]

Description

Read the value from a specified digital input pin of the EtherCAT slave device.

Derived Class:

Class          Name	        VID	        PID       Inputs Outputs   MCU	DC	Wire Detection
EthercatDevice_QECR00DF0S	0x00000bc3	0x0086d30D	16	 0	        O		
EthercatDevice_QECR00DF0D	0x00000bc3	0x0086d300	16	 0	        O		O
EthercatDevice_QECR00DF0H	0x00000bc3	0x0086d30B	16	 0	        O	O	
EthercatDevice_QECR00DT0L	0x00000bc3	0x0086d323	32	 0			
EthercatDevice_QECR00DT0H	0x00000bc3	0x0086d701	32	 0	        O	O	
EthercatDevice_QECR00D88S	0x00000bc3	0x0086d309	8	 8	        O		
EthercatDevice_QECR00D88D	0x00000bc3	0x0086d301	8	 8	        O		O
EthercatDevice_QECR00D88H	0x00000bc3	0x0086d30F	8	 8	        O	O	
EthercatDevice_QECR00DC4D	0x00000bc3	0x0086d304	12	 4	        O		O
EthercatDevice_QECR00D4CD	0x00000bc3	0x0086d302	4	 12	        O		O
EthercatDevice_QECR11DF0S	0x00000bc3	0x0086d30E	16	 0	        O		
EthercatDevice_QECR11DF0D	0x00000bc3	0x0086d0d2	16	 0	        O		O
EthercatDevice_QECR11DF0H	0x00000bc3	0x0086d306	16	 0	        O	O	

Syntax

int digitalRead(int pin);

Parameters

  • [in] int pin
    The digital input pin number of the EtherCAT slave device.

Return Value

Return the digital logic level of the specified digital pin. The value is HIGH or LOW.

Comment

This function must be called after a successful execution of EthercatMaster::start() and before EthercatMaster::stop(). This function is non-blocking and can be called within the callback functions.

Example

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR00D88D slave;

void setup() {
  Serial.begin(115200);
  master.begin();
  slave.attach(0, master);
  master.start();
}

void loop() {
  slave.digitalWrite(0, HIGH);
  delay(1000);

  Serial.print("DI0: ");
  Serial.println(slave.digitalRead(0));

  slave.digitalWrite(0, LOW);
  delay(1000);

  Serial.print("DI0: ");
  Serial.println(slave.digitalRead(0));
}

Please see EthercatDevice_DmpDIQ_Generic Class for more QEC DIO slave instructions and API usage.

Scroll to Top