[EthercatDevice_DmpLCD_Generic]
描述
Read the Y-axis position of the touch point on the touchscreen of the LCD module on the EtherCAT slave device. The coordinate will be rotated according to the configuration of lcdSetRotation()
.
衍生類別:
Class Name | Vendor ID | Product Code |
EthercatDevice_QECR11UN01 | 0x00000bc3 | 0x0086d103 |
EthercatDevice_QECR00UN01 | 0x00000bc3 | 0x0086d100 |
語法
int touchY(size_t point = 0);
參數
[in] size_t point
Touchpoint sequence number. If the device supports multi-touch, this parameter can be used to read the X-axis position of the specified touch point.- 0: 1st touch point.
- 1: 2nd touch point.
- ...等等
回傳值
Return the Y-axis position of the touch point. If the return value is smaller than 0, it means an 錯誤代碼.
備註
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.
範例
#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 類別 for more QEC Stepper Drivers instructions and API usage.