Skip to content

Instantly share code, notes, and snippets.

View mizbit's full-sized avatar

David MiZak mizbit

View GitHub Profile
@mizbit
mizbit / led-tach.ino
Created August 23, 2020 21:39 — forked from nikita240/led-tach.ino
arduino-tachometer
#include <Adafruit_NeoPixel.h>
const int LED_PIN = 6;
const int TACH_PIN = 2;
const int BRIGHTNESS = 100;
const int LED_COUNT = 80;
const int REDLINE = 7500;
const int WARN_RPM = 6000;
const int WARN_INTERVAL = 70;
@mizbit
mizbit / shifty.ino
Created August 23, 2020 21:48 — forked from jdrusso/shifty.ino
//Miata shift light!
// Ignition frequency is equal to RPM/30
//initialize libraries
#include <Bounce2.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
/*
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: mills.pete@gmail.com
@mizbit
mizbit / ButtonTest.INO
Created August 23, 2020 21:57 — forked from macchina/ButtonTest.INO
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
@mizbit
mizbit / PWM_nVPW.INO
Created August 23, 2020 21:57 — forked from macchina/PWM_nVPW.INO
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
@mizbit
mizbit / LowPowerControl.INO
Created August 23, 2020 21:57 — forked from macchina/LowPowerControl.INO
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
}
@mizbit
mizbit / Fade.INO
Created August 23, 2020 21:57 — forked from macchina/Fade.INO
/*
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
@mizbit
mizbit / 12VIO_test.INO
Created August 23, 2020 21:57 — forked from macchina/12VIO_test.INO
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
@mizbit
mizbit / MainActivity.kt
Created September 15, 2020 01:03 — forked from patrickhammond/MainActivity.kt
Raspberry Pi 3 running Android Things driving an Arduino Uno to control an RGB LED
package com.madebyatomicrobot.things
import android.app.Activity
import android.os.Bundle
import android.util.Log
import android.widget.SeekBar
import android.widget.SeekBar.OnSeekBarChangeListener
import android.widget.TextView
import com.google.android.things.pio.PeripheralManagerService
import com.google.android.things.pio.UartDevice
@mizbit
mizbit / Speedometer_HMI.ino
Created November 7, 2020 19:23 — forked from matt448/Speedometer_HMI.ino
Arduino based speedometer using a Nextion HMI Display
#include "Nextion.h"
const int lightPin = 0;
const int hardwareCounterPin = 5;
const int samplePeriod = 1000; //in milliseconds
const float pulsesPerMile = 4000;
const float convertMph = pulsesPerMile/3600;
unsigned int count;
float mph;