Skip to content

Instantly share code, notes, and snippets.

View amcjen's full-sized avatar

Allison Clift-Jennings amcjen

View GitHub Profile
// -------------------------------------------------------------
// CANtest for Teensy 3.6 dual CAN bus
// by Collin Kidder, Based on CANTest by Pawelsky (based on CANtest by teachop)
//
// Both buses are left at default 250k speed and the second bus sends frames to the first
// to do this properly you should have the two buses linked together. This sketch
// also assumes that you need to set enable pins active. Comment out if not using
// enable pins or set them to your correct pins.
//
// This sketch tests both buses as well as interrupt driven Rx and Tx. There are only
static const uart_conf_t uart_config[] = {
{ /* Virtual COM Port */
.dev = &SERCOM4->USART,
.rx_pin = GPIO_PIN(PB,14),
.tx_pin = GPIO_PIN(PB,15),
.mux = GPIO_MUX_D,
.rx_pad = UART_PAD_RX_2,
.tx_pad = UART_PAD_TX_3,
.flags = UART_FLAG_NONE,
.gclk_src = GCLK_PCHCTRL_GEN_GCLK0
#include <Bounce.h> // Bounce library makes button change detection easy
const int channel = 1;
Bounce button1 = Bounce(1, 5); // 5 = 5 ms debounce time
Bounce button2 = Bounce(2, 5); // which is appropriate for good
// quality mechanical pushbuttons
void setup() {
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
}
#include <Bounce.h> // Bounce library makes button change detection easy
const int channel = 1;
Bounce button1 = Bounce(1, 5); // 5 = 5 ms debounce time
Bounce button2 = Bounce(2, 5); // which is appropriate for good
Bounce button3 = Bounce(3, 5); // quality mechanical pushbuttons
void setup() {
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
@amcjen
amcjen / buttondemo.ino
Created October 14, 2017 07:21
Project Tonic Button Demo
const int ledPin = 13;
const int button1Pin = 2;
const int button2Pin = 3;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(button1Pin, INPUT_PULLUP);
pinMode(button2Pin, INPUT_PULLUP);
}

Keybase proof

I hereby claim:

  • I am amcjen on github.
  • I am amcjen (https://keybase.io/amcjen) on keybase.
  • I have a public key ASBgceVqmZYML5YKhvUM9YfnF867u95mxCoNMzpQ1qsEPgo

To claim this, I am signing this object:

@amcjen
amcjen / gist:c1dd50e23c14bea8b0318d832ce752ee
Created July 6, 2016 19:17
LT3101 Power Button Behavior
PUSHBUTTON INTERFACE
The LTC3101 includes a pushbutton interface that allows a single momentary pushbutton to control the sequenced power-up and power-down of all output rails in coordina- tion with an external microprocessor. In addition, three independent enable pins allow an unused DC/DC converter to be independently disabled and also provide the means to manually implement an alternate power-up sequence.
The LTC3101 can be enabled by either forcing PWRON high or by forcing PWRKEY low. In either case, the DC/DC converters (if enabled by their respective enable pin) will power up in the internally fixed default sequence: buck converter 1, buck converter 2, and finally the buck- boost converter. In the typical application, the power-on sequence is initiated when the PWRKEY is driven low by an external momentary pushbutton. Once the microproces- sor is powered up it must assert PWRON high before the pushbutton is released, thereby forcing the LTC3101 to
remain enabled. Power-down is usually accomplished by
to install node:
- run: `curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash`
- Follow instructions
#include <SPI.h>
#include <Wire.h>
#include <Scout.h>
#include <GS.h>
/* MANUAL PROVISIONING BITLASH COMMANDS
mesh.config(<Scout ID>, <Troop ID>)
mesh.key("<mesh encryption key with max 16 chars>")
wifi.config("<Access point name>", "<Access point password>", "173.255.220.185", 22756)
scout.sethqtoken("<HQ Token String>")
cli();
wdt_enable(WDTO_15MS);
while(1);