Skip to content

Instantly share code, notes, and snippets.

@dragonlock2
dragonlock2 / EEPROM.cpp
Created Jan 8, 2021
Code to interact with BRCF016GWZ
View EEPROM.cpp
#include "EEPROM.h"
extern I2C i2c;
namespace EEPROM {
void resetEEPROM() {
char buff[MAX_BLOCK_WRITE];
for (uint16_t i = 0; i < MAX_BLOCK_WRITE; i++) {
buff[i] = 0xFF;
@dragonlock2
dragonlock2 / WLPROM.cpp
Last active Jan 8, 2021
Simple EEPROM wear leveling algorithm
View WLPROM.cpp
#include "WLPROM.h"
namespace WLPROM {
void read(WLData* dat) {
EEPROM::readBites(findData(), (char*) dat, sizeof(WLData));
}
void write(WLData* dat) {
uint16_t next_addr = findData() + sizeof(WLData);
@dragonlock2
dragonlock2 / resume.sty
Created Sep 21, 2020
My LaTeX resume template
View resume.sty
% Original template by Abhinay Korukonda
% Heavily modified by Matthew Tran
%%% PACKAGES
% Used for scaling
\usepackage{relsize}
% Font
\usepackage{tgpagella}
% Microtyping, apparently makes things look better
@dragonlock2
dragonlock2 / BSWelder.ino
Created Jan 16, 2020
Code for my battery spot welder.
View BSWelder.ino
#include <Encoder.h>
#include <EEPROM.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
@dragonlock2
dragonlock2 / Lightsaber_v3.ino
Created Sep 30, 2019
Code for my lightsaber v3.
View Lightsaber_v3.ino
#include <TMRpcm.h> //audio libs
#include <SPI.h>
#include <SdFat.h>
#include "I2Cdev.h" //gyro libs
#include "MPU6050.h"
#include "Wire.h"
SdFat sd;
File file;
@dragonlock2
dragonlock2 / MP_v3.ino
Created Sep 2, 2019
Code for my device for Science Olympiad Mission Possible 2018.
View MP_v3.ino
/*
* MP_v3 code
* written by: Matthew Tran
* version: 051318
*/
//input
//#define BALLOON
//#define IR_IN
//#define PELT_IN
@dragonlock2
dragonlock2 / Lightsaber_v4.ino
Created Sep 1, 2019
Code for my 4th gen Arduino based lightsaber.
View Lightsaber_v4.ino
#include <TMRpcm.h>
#include <SdFat.h>
//#include <CapacitiveSensor.h>
File file;
SdFat SD;
TMRpcm audio;
//CapacitiveSensor top = CapacitiveSensor(A0, A1); //20M resistor between, antenna on A1
@dragonlock2
dragonlock2 / Reflow_v1.ino
Created Aug 29, 2019
Code for my Reflow oven.
View Reflow_v1.ino
#include "max6675.h"
#include <LiquidCrystal.h>
#include <PID_v1.h>
//profiles
const int NUM_PROFILES = 2;
const int NUM_POINTS = 5;
String profiles[] = {"Lead (Sn63 Pb37)",
"Lead-free SAC305",
"Manual Control "}; //16 char long
@dragonlock2
dragonlock2 / main.c
Created Aug 28, 2019
STM32 Keypad Main Code
View main.c
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
* This notice applies to any and all portions of this file
* that are not between comment pairs USER CODE BEGIN and
* USER CODE END. Other portions of this file, whether
* inserted by the user or by software development tools
* are owned by their respective copyright owners.
@dragonlock2
dragonlock2 / PCB_Laminator_v1.5.ino
Created Aug 23, 2019
Code powering my PCB Laminator
View PCB_Laminator_v1.5.ino
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Servo.h>
#include <Encoder.h>
#include <PID_v1.h>
//display stuff
#define FRAME_RATE 130 //in ms, takes about 112ms actually
#define SCREEN_WIDTH 128 // OLED display width, in pixels