サイト内検索

検索

Shares

Table of Content

EthercatDevice_DmpAIQ.analogRead()

[EthercatDevice_DmpAIQ_Generic]

説明

EtherCATスレーブデバイスのアナログ入力ピンから値を読みます。

派生クラス:

クラス名製造者ID製品コードInput ChannelsOutput Channels
EthercatDevice_QECR11A44S0x00000bc30x0086d88044

構文

int analogRead(int ch);

媒介変数

  • [in] int ch
    EtherCATスレーブデバイス上の指定されたアナログ入力チャネル。

戻り値

アナログ入力値として、-231 から231 の範囲をもつ32ビットの符号付き整数を返します。その値は、物理的な入力電圧にボルト単位で、0の値は、電圧0V、231 は 64V、そして -231 は -64Vに線形にマッピングされます。

備考

この関数は、 EthercatMaster::start() が正常に実行された後で、 EthercatMaster::stop()の前に呼び出す必要があります。この関数はブロッキングされていないため、コールバック関数内で呼び出すことができます。

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR11A44S slave;

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

void loop() {
  Serial.print("AIO: ");
  Serial.println(slave.analogRead(0));
  delay(1000);
}

Please see EthercatDevice_DmpAIQ_Generic Class for more QEC AIO slave instructions and API usage.

上部へスクロール