checkReceive()
説明
CAN FIFO検査が読み取り可能な値があるか否かである。(この関数は Seeed Studio の CAN Bus 関数となる。注意:この関数はreadMsgBuf() を使用する。)
語法
CAN.checkReceive(void)
パラメータ
無
戻り値
CAN_MSGAVAIL:FIFO内に読み取り可能なデータを表す。
CAN_NOMSG:FIFO内にデータが無いことを表す。
例
#include <CANBus.h> unsigned char len = 0; unsigned char buf[8]; void setup() { Serial.begin(115200); CAN.begin(CAN_500KBPS); } void loop() { if(CAN_MSGAVAIL == CAN.checkReceive()) // データが送信されているかどうか { CAN.readMsgBuf(&len, buf); // データ読み取り for(int i = 0; i<len; i++) // データ値出力 { Serial.print(buf[i]);Serial.print("\t"); } Serial.println(); } }
See also
- readMsgBuf()
The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.