Skip to content

Instantly share code, notes, and snippets.

Matt McMillan matt448

Block or report user

Report or block matt448

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@matt448
matt448 / slack_nagios.sh
Last active Aug 14, 2019
Script to post Nagios notifications into a Slack channel
View slack_nagios.sh
#!/bin/bash
# This script is used by Nagios to post alerts into a Slack channel
# using the Incoming WebHooks integration. Create the channel, botname
# and integration first and then add this notification script in your
# Nagios configuration.
#
# All variables that start with NAGIOS_ are provided by Nagios as
# environment variables when an notification is generated.
# A list of the env variables is available here:
@matt448
matt448 / hx711_calibration.ino
Last active Aug 8, 2019
HX711 Calibration for Arduino
View hx711_calibration.ino
/*
Started with example code written by Nathan Seidle from SparkFun Electronics and added
LCD output with gram and ounce values.
Setup your scale and start the sketch WITHOUT a weight on the scale
Once readings are displayed place the weight on the scale
Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
Arduino pin 6 -> HX711 CLK
Arduino pin 5 -> HX711 DOUT
@matt448
matt448 / Speedometer_HMI.ino
Created Jun 1, 2017
Arduino based speedometer using a Nextion HMI Display
View Speedometer_HMI.ino
#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;
View CAN_Sender_500k_11bit.ino
/////////////////////////////////////////////////////////////////////
// This is a simple example of sending CAN messages with 11bit id's
//
// https://matthewcmcmillan.blogspot.com
// Twitter: @matthewmcmillan
//
#include "mcp_can.h"
#include <SPI.h>
View CAN_Sender_500k_29bit.ino
/////////////////////////////////////////////////////////////////////
// This is a simple example of sending CAN messages with 29bit id's
//
// https://matthewcmcmillan.blogspot.com
// Twitter: @matthewmcmillan
//
#include "mcp_can.h"
#include <SPI.h>
@matt448
matt448 / Speedometer_TM1637.ino
Created Jan 13, 2016
Digital speedometer using a TM1637 type display
View Speedometer_TM1637.ino
// Matthew McMillan
// @matthewmcmillan
// http://matthewcmcmillan.blogspot.com
//
// Digital speedometer that uses a TM1637 type display
//
// Code is written for an Arduino UNO
//
// VSS on car connects to digital pin 5
// CLK on display to digital pin 3
@matt448
matt448 / SPI_Digital_Pot_AD8403.ino
Created Oct 24, 2013
Example code for controlling an AD8403 Digital Potentiometer. Please see https://github.com/matt448/arduino for the latest version of this code.
View SPI_Digital_Pot_AD8403.ino
/*
Digital Pot Control
This example controls an Analog Devices AD8403 digital potentiometer.
The AD8403 has 4 potentiometer channels. Each channel's pins are labeled
A - connect this to voltage
W - this is the pot's wiper, which changes when you set it
B - connect this to ground.
The AD8403 is SPI-compatible. To command it you send two bytes.
@matt448
matt448 / tft_test.ino
Last active Nov 3, 2017
This is a simple sketch I used to test the refresh rate of an Adafruit 2.2" TFT display on an Arduino Mega 2560. http://www.adafruit.com/products/1480
View tft_test.ino
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9340.h"
#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal
#endif
// These are the pins used for the Mega
@matt448
matt448 / can_reciever.ino
Last active Oct 19, 2017
Code for example CAN bus receiver.
View can_reciever.ino
// demo: CAN-BUS Shield, receive data
#include "mcp_can.h"
#include <SPI.h>
#include <LiquidCrystal.h>
#include <stdio.h>
#define INT8U unsigned char
INT8U Flag_Recv = 0;
INT8U len = 0;
INT8U buf[8];
@matt448
matt448 / speed_test.py
Created Sep 5, 2014
BeagleBone Black TFT Display Testing
View speed_test.py
#!/usr/bin/python
import Image
import ImageDraw
import ImageFont
import glob
import Adafruit_BBIO.ADC as ADC
import time
You can’t perform that action at this time.