Skip to content

Instantly share code, notes, and snippets.

#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;
// 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 <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.
/********************************************************************/
#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.
/********************************************************************/
// 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;
//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"
@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;
// Demo program for testing DIGI cellular module.
// Looks for "Emergency flasher button was pressed" CAN message in 2006 Ford Fusion and sends text.
// Digi module needs to be set up to send SMS first for this sketch to work:
// http://www.digi.com/resources/documentation/digidocs/90001525/default.htm
// Specifically this example:
// http://www.digi.com/resources/documentation/digidocs/90001525/default.htm#tasks/t_send_sms.htm%3FTocPath%3DGetting%2520started%7CExamples%7C_____2
#include "variant.h"
#include <due_can.h>
#include "SamNonDuePin.h"
/*
Heavily modified from below code - works with NEOPIXEL 24 pos ring and M2 hardware.
Program Name: blueShift
Version: v0.7
Author: Pete Mills
Website: petemills.blogspot.com
Email: [email protected]
@macchina
macchina / hsmci_example.ino
Created August 3, 2016 18:30
HSMCI speed test
/*
Test code for SD_HSMCI library
Initialises and reads the SD card properties before writing 5 files of between 5120 bytes
and 5120000 bytes to the root directory of the card. The time taken for each file write
and read is printed to the initialised Serial out. 512 is the blocksize set so this should
give optimum performance.
No checking for free space is done on the SD card.
Card detect works on the Duet, it will wait for a card to be inserted.