Skip to content

Instantly share code, notes, and snippets.

@matt448
matt448 / speed_test.py
Created September 5, 2014 04:48
BeagleBone Black TFT Display Testing
#!/usr/bin/python
import Image
import ImageDraw
import ImageFont
import glob
import Adafruit_BBIO.ADC as ADC
import time
@matt448
matt448 / tft_test.ino
Last active November 3, 2017 20:21
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
#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
/////////////////////////////////////////////////////////////////////
// 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>
/////////////////////////////////////////////////////////////////////
// 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>
@matt448
matt448 / serialtest.py
Last active July 16, 2020 19:45
Python script to test the CAN data sent by the Trinket CAN to UART converter
#!/usr/bin/python
##########################################
# https://matthewcmcmillan.blogspot.com
# Twitter: @matthewmcmillan
#
# For the most up to date version of this file see:
# https://github.com/matt448/Digital_Dash_v2/blob/master/serialtest.py
#
@matt448
matt448 / tft_speedo_with_sd_card.ino
Last active July 16, 2020 19:45
This code is a work in progress for my TFT speedometer project.
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9340.h"
#include <SD.h>
#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal
#endif
@matt448
matt448 / Speedometer_7seg.ino
Created February 4, 2014 03:56
Code that controls my Arduino based digital speedometer. This version uses a seven segment LED display.
// Matthew McMillan
// @matthewmcmillan
// http://matthewcmcmillan.blogspot.com
//
// Digital speedometer
//
// VSS on car connects to pin 5
// CLK on display to Analog pin 5
// DAT on display to Analog pin 4
//
@matt448
matt448 / Speedometer_TM1637.ino
Created January 13, 2016 02:30
Digital speedometer using a TM1637 type display
// 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 / can_reciever.ino
Last active August 27, 2021 21:04
Code for example CAN bus receiver.
// 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 / Speedometer_HMI.ino
Created June 1, 2017 15:47
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;