[EthercatDevice_DmpHID_Generic]
説明
EtherCATスレーブデバイスのキーパッドから入力文字を読み取ります。
構文
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 error codeを示します。.
備考
この関数は、 EthercatMaster::begin()が正常に実行された後に呼び出す必要があります。この関数はブロッキングされていないため、循環コールバック内で呼び出すことができます。
例
#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 Class for more QEC HID slave instructions and API usage.