[EthercatDevice_DmpHID_Generic]
描述
Read the input character from the keypad of the EtherCAT slave device.
語法
int keypadRead();
參數
無
回傳值
Read a character from the keypad. Return ‘\0’ if no data is available. If the return value is less than 0, it indicates an 錯誤代碼.
備註
This function must be called after a successful execution of EthercatMaster::begin()
. This function is non-blocking and can be called within the Cyclic Callback.
範例
#include "Ethercat.h" EthercatMaster master; EthercatDevice_QECR11HU9S slave; void CyclicCallback() { slave.update(); } void setup() { Serial.begin(115200); master.begin(); slave.attach(0, master); master.attachCyclicCallback(CyclicCallback); master.start(); } void loop() { int ch; if ((ch = slave.keypadRead()) != '\0') { Serial.print((char)ch); } // ... }
Please see EthercatDevice_DmpHID_Generic 類別 for more QEC HID slave instructions and API usage.