Skip to content

Instantly share code, notes, and snippets.

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://arduino.cc
This example code is in the public domain.
##############################################################
macchina.name=Macchina
macchina.vid.0=0x2341
macchina.pid.0=0x003f
macchina.vid.1=0x2341
macchina.pid.1=0x0044
macchina.upload.tool=avrdude
@rechargecar
rechargecar / gist:4177995
Created November 30, 2012 19:34
MCP2515 basic reading (and writing)
byte i=0;
// CAN message frame (actually just the parts that are exposed by the MCP2515 RX/TX buffers)
Frame message;
void loop() {
message.id = 0;
// This implementation utilizes the MCP2515 INT pin to flag received messages or other events
@rechargecar
rechargecar / gist:4177971
Created November 30, 2012 19:29
MCP2515 basic setup with Macchina
#include <SPI.h> // Arduino SPI Library
#include <MCP2515.h>
// Pin definitions specific to how the MCP2515 is wired up.
#define CS_PIN 85
#define RESET_PIN 7
#define INT_PIN 84
// Create CAN object with pins as defined
MCP2515 CAN(CS_PIN, RESET_PIN, INT_PIN);
@rechargecar
rechargecar / CANTest.ino
Created November 30, 2012 19:10
MCP2515 Library example
/*
MCP2515 CAN Interface Using SPI
Author: David Harding
Created: 11/08/2010
Modified: 6/26/12 by RechargeCar Inc.
For further information see:
@rechargecar
rechargecar / frame.h
Created November 30, 2012 08:57
CAN Frame struct
typedef struct
{
unsigned long id; // EID if ide set, SID otherwise
byte srr; // Standard Frame Remote Transmit Request
byte rtr; // Remote Transmission Request
byte ide; // Extended ID flag
byte dlc; // Number of data bytes
byte data[8]; // Data bytes
} Frame;