Skip to content

Instantly share code, notes, and snippets.

//Modified: 8/26/20 by Kenny-Macchina
/*
MCP2515 CAN Interface Using SPI
Author: David Harding
Created: 11/08/2010
Modified: 6/26/12 by RechargeCar Inc.
//Modified: 8/26/20 by Kenny-Macchina
/*
MCP2515 CAN Interface Using SPI
Author: David Harding
Created: 11/08/2010
Modified: 6/26/12 by RechargeCar Inc.
//Macchina LLC
//Collin Kidder
//Queries over the CAN bus to see if anything responds to a VIN number request
#include <Arduino_Due_SD_HSMCI.h>
#include "Arduino.h"
#include <M2_12VIO.h>
#include <due_can.h>
#include <iso-tp.h>
import can
from can.interface import Bus
from can import Message
import os
from datetime import datetime
from datetime import time
import csv
os.system('sudo ip link set can0 down')
os.system('sudo ip link set can0 up type can bitrate 500000')
#include <esp32_can.h>
uint8_t codes[4] = {5, 0xB, 0xC, 0xD};
int idx = 0;
uint32_t tick = 0;
const int led_pin = 13;
char msg_buf[10];
int led_state = 0;
#include "esp32_can.h"
void setup()
{
Serial.begin(115200);
CAN0.setCANPins((gpio_num_t)4,(gpio_num_t)5);
Serial.println("Initializing ...");
// Required libraries
#include "variant.h"
#include <due_can.h>
//Leave defined if you use native port, comment if using programming port
#define Serial SerialUSB
void setup()
{
Serial.begin(115200);