Skip to content

Commit

Permalink
Remove additional SPI.begin in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jxltom committed Apr 8, 2020
1 parent af2e820 commit e672e29
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 13 deletions.
3 changes: 0 additions & 3 deletions examples/CAN_SpeedTest/CAN_SpeedTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ unsigned long oldTime = 0;

void setup() {
Serial.begin(115200);
SPI.begin();

mcp2515.reset();
mcp2515.setBitrate(CAN_125KBPS);
Expand All @@ -19,7 +18,6 @@ void setup() {
}

void loop() {

if (mcp2515.readMessage(&canMsg) == MCP2515::ERROR_OK) {
cntr++;
}
Expand All @@ -30,5 +28,4 @@ void loop() {
Serial.println(" msg/sec");
cntr = 0;
}

}
6 changes: 0 additions & 6 deletions examples/CAN_read/CAN_read.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ MCP2515 mcp2515(10);

void setup() {
Serial.begin(115200);
SPI.begin();

mcp2515.reset();
mcp2515.setBitrate(CAN_125KBPS);
Expand All @@ -18,22 +17,17 @@ void setup() {
}

void loop() {

if (mcp2515.readMessage(&canMsg) == MCP2515::ERROR_OK) {

Serial.print(canMsg.can_id, HEX); // print ID
Serial.print(" ");
Serial.print(canMsg.can_dlc, HEX); // print DLC
Serial.print(" ");

for (int i = 0; i<canMsg.can_dlc; i++) { // print the data

Serial.print(canMsg.data[i],HEX);
Serial.print(" ");

}

Serial.println();
}

}
4 changes: 0 additions & 4 deletions examples/CAN_write/CAN_write.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ MCP2515 mcp2515(10);


void setup() {

canMsg1.can_id = 0x0F6;
canMsg1.can_dlc = 8;
canMsg1.data[0] = 0x8E;
Expand All @@ -32,7 +31,6 @@ void setup() {

while (!Serial);
Serial.begin(115200);
SPI.begin();

mcp2515.reset();
mcp2515.setBitrate(CAN_125KBPS);
Expand All @@ -42,12 +40,10 @@ void setup() {
}

void loop() {

mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg2);

Serial.println("Messages sent");

delay(100);

}

0 comments on commit e672e29

Please sign in to comment.