Skip to content

Instantly share code, notes, and snippets.

@macchina
macchina / M2_9141_READ.INO
Created July 26, 2016 19:30
ISO9141 read example for M2
/*
* Example based on code found here.
* https://github.com/iwanders/OBD9141
*
* Put the "OBD9141 in Libraries folder.
*
*/
#include "OBD9141.h"
#include "SamNonDuePin.h"
@macchina
macchina / ButtonTest.INO
Created July 19, 2016 15:13
Demonstrates using "Non-Due" pins for Button inputs and LED outputs.
/*
Demonstrates using "Non-Due" pins for Button inputs and LED outputs.
*/
#include "Arduino.h"
#include "SamNonDuePin.h"
// constants won't change. They're used here to
// set pin numbers:
const int SW1 = X1; // Pushbutton SW1
@macchina
macchina / PWM_nVPW.INO
Created June 21, 2016 17:21
Controls PWM/VPW level
#include "SamNonDuePin.h"
const int LPC = PIN_EMAC_ERX0; // LOW POWER CONTROL pin
const int PWM_nVPW = PIN_EMAC_EMDC; // PWM/VPW level control
void setup() {
pinModeNonDue(LPC, OUTPUT);
pinModeNonDue(PWM_nVPW, OUTPUT);
digitalWriteNonDue(LPC, HIGH); // LOW = no power at +12V_SW/+5V_SW
@macchina
macchina / LowPowerControl.INO
Created June 21, 2016 16:34
Demonstrates how to turn on and off switched 12V and 5V rails.
#include "SamNonDuePin.h"
const int LPC = PIN_EMAC_ERX0; // LOW POWER CONTROL pin
void setup() {
pinModeNonDue(LPC, OUTPUT);
digitalWriteNonDue(LPC, LOW); // LOW = no power at +12V_SW/+5V_SW
// HIGH = power at +12V_SW/+5V_SW
}
/*
Fade
Modified 6/6/16 to demonstrate Macchina 2.0 RGB LEDs,
also functioning as a HELLO WORLD type sketch.
This example shows how to fade an LED on the RGB LED
using the analogWrite() function.
The analogWrite() function uses PWM, so if
@macchina
macchina / 12VIO_test.INO
Last active August 23, 2020 21:57
Sketch to test PWM on the 12volt I/O (SOURCES 12volt)
#define MASTER_CLOCK 84000000
#include "SamNonDuePin.h"
uint32_t clock_a = 42000000; // Sampling frequency in Hz
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
const int IOENABLE = 6; // the number of the 12Vio_EN pin
@macchina
macchina / boards.txt
Last active August 29, 2015 14:17
boards.txt addition for Macchina 1.0/1.1
##############################################################
macchina.name=Macchina
macchina.vid.0=0x2341
macchina.pid.0=0x003f
macchina.vid.1=0x2341
macchina.pid.1=0x0044
macchina.upload.tool=avrdude