[EthercatDevice_DmpLCD_Generic]
説明
EtherCATスレーブデバイスのLCDモジュールのタッチスクリーン上のタッチポイントのX座標を読み取ります。座標はlcdSetRotation()
の設定に従って回転します。
派生クラス:
クラス名 | 製造者ID | 製品コード |
EthercatDevice_QECR11UN01 | 0x00000bc3 | 0x0086d103 |
EthercatDevice_QECR00UN01 | 0x00000bc3 | 0x0086d100 |
構文
int touchX(size_t point = 0);
媒介変数
[in] size_t point
タッチポイントのシーケンス番号。デバイスがマルチタッチをサポートしている場合、このパラメータを使用して、指定されたタッチポイントのX座標を読み取ることができます。- 0: 1番目のタッチポイント。
- 1: 2番目のタッチポイント。
- など。
戻り値
Return the X-axis position of the touch point. If the return value is smaller than 0, it means an error codeを示します。.
備考
この関数は、 EthercatMaster::start()
が正常に実行された後で、 EthercatMaster::stop()
の前に呼び出す必要があります。この関数はブロッキングされていないため、コールバック関数内で呼び出すことができます。
例
#include "Ethercat.h" EthercatMaster master; EthercatDevice_QECR00UN01 slave; bool Touched = false; int TouchX; int TouchY; void CyclicCallback() { if (!Touched && slave.isTouched() > 0) { Touched = true; TouchX = slave.touchX(); TouchY = slave.touchY(); } } void setup() { Serial.begin(115200); master.begin(); slave.attach(0, master); slave.lcdInit(ECAT_LCD_ILI9341_1); master.attachCyclicCallback(CyclicCallback); master.start(); } void loop() { if (Touched) { Serial.print("Touched. X: "); Serial.print(TouchX); Serial.print(", Y: "); Serial.println(TouchY); delay(500); Touched = false; } // ... }
Please see EthercatDevice_DmpLCD_Generic Class for more QEC Stepper Drivers instructions and API usage.