mirror of
https://github.com/Seeed-Studio/Seeed_Arduino_CAN.git
synced 2026-09-15 02:52:53 +00:00
Modified canbus send and receive example
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
// loovee, 2014-6-13
|
||||
|
||||
#include <SPI.h>
|
||||
#include "mcp2515_can.h"
|
||||
#include "mcp2518fd_can.h"
|
||||
|
||||
/*SAMD core*/
|
||||
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
|
||||
@@ -13,18 +11,23 @@
|
||||
#define SERIAL Serial
|
||||
#endif
|
||||
|
||||
#define CAN_2518FD
|
||||
|
||||
#define CAN_2515
|
||||
//#define CAN_2518FD
|
||||
// the cs pin of the version after v1.1 is default to D9
|
||||
// v0.9b and v1.0 is default D10
|
||||
const int SPI_CS_PIN = BCM8;
|
||||
const int CAN_INT_PIN = BCM25;
|
||||
|
||||
|
||||
#ifdef CAN_2518FD
|
||||
#include "mcp2518fd_can.h"
|
||||
const int SPI_CS_PIN = BCM8;
|
||||
const int CAN_INT_PIN = BCM25;
|
||||
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
|
||||
#endif
|
||||
|
||||
#ifdef CAN_2515
|
||||
#include "mcp2515_can.h"
|
||||
const int SPI_CS_PIN = 9;
|
||||
const int CAN_INT_PIN = 2;
|
||||
mcp2515_can CAN(SPI_CS_PIN); // Set CS pin
|
||||
#endif // Set CS pin
|
||||
|
||||
|
||||
+10
-3
@@ -14,18 +14,25 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define CAN_2515
|
||||
//#define CAN_2515
|
||||
#define CAN_2518FD
|
||||
// the cs pin of the version after v1.1 is default to D9
|
||||
// v0.9b and v1.0 is default D10
|
||||
const int SPI_CS_PIN = 9;
|
||||
|
||||
|
||||
#ifdef CAN_2518FD
|
||||
#include "mcp2518fd_can.h"
|
||||
const int SPI_CS_PIN = BCM8;
|
||||
const int CAN_INT_PIN = BCM25;
|
||||
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
|
||||
#endif
|
||||
|
||||
#ifdef CAN_2515
|
||||
#include "mcp2515_can.h"
|
||||
const int SPI_CS_PIN = 9;
|
||||
const int CAN_INT_PIN = 2;
|
||||
mcp2515_can CAN(SPI_CS_PIN); // Set CS pin
|
||||
#endif
|
||||
#endif // Set CS pin
|
||||
|
||||
void setup() {
|
||||
SERIAL.begin(115200);
|
||||
|
||||
Reference in New Issue
Block a user