Skip to content

Instantly share code, notes, and snippets.

@macchina
macchina / flashers.INO
Last active April 16, 2018 17:27
Send CAN message to make flashers flash in 2006 Ford Fusion.
// Demo showing how to send CAN message to make flashers flash in 2006 Ford Fusion.
#include "variant.h"
#include <due_can.h>
#include "SamNonDuePin.h"
#define Serial SerialUSB
const int LOWPOW = PIN_EMAC_ERX0;
//Test extEEPROM library.
//Writes the EEPROM full of 32-bit integers and reads them back to verify.
//Wire a button from digital pin 6 to ground, this is used as a start button
//so the sketch doesn't do unnecessary EEPROM writes every time it's reset.
//Jack Christensen 09Jul2014
#include <extEEPROM.h> //http://github.com/JChristensen/extEEPROM/tree/dev
#include <Streaming.h> //http://arduiniana.org/libraries/streaming/
#include <Wire.h> //http://arduino.cc/en/Reference/Wire
#include "SamNonDuePin.h"
// This is a VERY quick sketch as a proof of concept to see if we can start a car via SWCAN. This code won't work as-is, the data shown is dummy data.
#include <mcp_can.h>
#include <SPI.h>
#include "SamNonDuePin.h"
const int Red = 32;
const int Yellow1 = X0;
const int Yellow2 = 27;
const int Green = 23;
#include <OBD2.h>
#include <DueTimer.h>
#include "SamNonDuePin.h"
/********************************************************************
This example is built upon the CANAcquisition class and the OBDParmameter class using extended OBD2 ID's
This example shows how to set up periodic data acquisition of OBD2 paramters based upon
standard PID's. If you'd like to add another paramter,simply copy one of the definitions and modify it accordingly.
You may also need to add a new PID to the "OBD_PID" enum in the header file.
/********************************************************************/
#include <OBD2.h>
#include <DueTimer.h>
#include "SamNonDuePin.h"
/********************************************************************
This example is built upon the CANAcquisition class and the OBDParmameter class using 11bit (non-extended) OBD2 ID's
This example shows how to set up periodic data acquisition of OBD2 paramters based upon
standard PID's. If you'd like to add another paramter,simply copy one of the definitions and modify it accordingly.
You may also need to add a new PID to the "OBD_PID" enum in the header file.
/********************************************************************/
// J1850 PWM/VPW pin initialization for Macchina M2
// This is just a code snippet showing how to use the J1850 PWM/VPW pins.
#include "SamNonDuePin.h"
// VPW/PWM pins:
const int LPC = PIN_EMAC_ERX0; // LOW POWER CONTROL pin
const int PWM_nVPW = PIN_EMAC_EMDC; // PWM/VPW level control, PB8
#include "SamNonDuePin.h"
bool led = 0;
bool toggleBootMode = false;
bool passThrough = false;
bool pipe = false;
const int XB_nRST = X4;
const int XB_GPIO0 = 29;
const int LED_YELLOW = X0;