I want to find...

Search

Shares

Table of Content

CAN.available()

[CANBus]

Description

Function to check whether there are data to read from the CAN interface’s FIFO buffer.

Syntax

CAN.available()

Parameters

None

Returns

Number of byte of data to read from the FIFO buffer.

Examples

#include <CANBus.h>
unsigned char ch;
void setup() {
    Serial.begin(115200);
    CAN.begin(CAN_500KBPS);
}
 
void loop() {
    if (CAN.requestFrom() > 0)         // Check to see whether data is read
    {
        while (CAN.available() > 0)    // Check FIFO to see whether there are data to be read
        {
            ch = CAN.read();           // Read data from FIFO
            Serial.print(ch);          // Output data content
            Serial.print("\t");
        }
        Serial.println();
    }
}

See also


Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Leave a Comment

Scroll to Top