Skip to content

Instantly share code, notes, and snippets.

View holachek's full-sized avatar

Michael holachek

View GitHub Profile
@holachek
holachek / main.c
Last active January 3, 2016 19:49
A slightly modified main.c
#define F_CPU 1000000 // CPU frequency for proper time calculation in delay function
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRD |= (1 << PD6); // make PD6 an output
for(;;)
@holachek
holachek / TechChange.c
Created July 15, 2013 18:49
TechChange Arduino Mood light! To run it this code, you'll need an Arduino Uno (or derivative), a piezo element, and a WS2801-compatible RGB LED (e.g., https://www.sparkfun.com/products/10504). You'll also need to download & install the FastSPI_LED library for Arduino: https://code.google.com/p/fastspi/
// TechChange Mood Lamp
// Version 0.1
// Michael Holachek
// Hardware:
// WS2801 LED connected to pins A3-A5
// Piezo element connected to pin 11 and ground
#include <FastSPI_LED.h>
@holachek
holachek / ToastieReflowOven_MASTER.ino
Last active December 16, 2015 16:40
Code for the Toastie Reflow Oven. Uses an Adafruit MAX31855 and Thermocouple, Serial LCD, piezo, relay, and fancy programming on an Arduino Mega. And, not to be forgotten: a shiny silver button.
// Reflow Oven
// Master Controller Sketch
// By Michael Holachek
// Version 1.0
#include "Adafruit_MAX31855.h"
#include <SoftwareSerial.h>
@holachek
holachek / main.c
Created November 26, 2012 16:45
Even or Odd program
// Tell me, is a number even or odd?
// Bug #1: Long integers cause scanf to truncate userNumber
#include <stdio.h>
int main()
{
int userNumber = 0;
@holachek
holachek / transcript.txt
Created October 29, 2012 13:04
Michael Holachek's Arduino AVR Video Tutorial transcript
In this video tutorial, I'm going to show you how to program an AVR microcontroller with the Arduino.
This allows you to expriment with individual AVR chips, without the cost or hassle of buying an AVR programmer.
Additionally, by learning how to program an AVR chip, you can understand how an Arduino works while making your own custom embedded system as small and inexpensive as possible.
I'll show you the process with an ATtiny2313 AVR and the Arduino Duemilanove.
If you’re using a different AVR chip, the pin connections will be slightly different.
Since we'll need the datasheet for reference, you'll probably want to download it now.
First, go to atmel.com, click in the search box, and type the name of your AVR.
Then, on the search results page, click the Datasheet link.
For this tutorial, you'll need:
An Arduino Duemilanove, Uno, or Mega;
@holachek
holachek / README.md
Created September 14, 2012 01:12
Virgin Mobile Minute Checker Python 3 Program

Virgin Mobile Minute Texter

Never go over your minutes again

Introduction

The Virgin Mobile Minute Texter is a simple Python script that scrapes your data from Virgin Mobile's website and sends you a text with your remaining minutes. Currently only works on the Virgin Mobile USA site.

Setup

First, make sure you have Python 3 installed by typing which python3 in a terminal. If you see something like /usr/local/bin/python3, you're good to go. If you see an error, install Python 3.

Go to and register for a free account. You'll use this service to send text messages to your phone. The free plan lets you send up to 1000 messages and 500 API requests a month. Copy your API Key from the Settings page.

@holachek
holachek / macros.h
Created August 10, 2012 03:01
Convenient Arduino-like pin macros
// super awesome Arduino-like pin macros save you from having to remember bitmasks
// code from Matthew T. Pandina's Demystifying the TLC5940 tutorial:
// URL: https://sites.google.com/site/artcfox/demystifying-the-tlc5940
#define setOutput(ddr, pin) ((ddr) |= (1<< (pin)))
#define setLow(port, pin) ((port) &= ~(1 << (pin)))
#define setHigh(port, pin) ((port) |= (1 << (pin)))
#define outputState(port, pin) ((port) & (1 << (pin)))
#define pulse(port, pin) do { \
setHigh((port), (pin)); \
@holachek
holachek / main.c
Created August 10, 2012 02:57
Toggle PD6 every second using AVR timers
#define LEDPORT PORTD
#define LEDBIT PD6
#define LEDDDR DDRD
#include <avr/io.h>
int main (void)
{
LEDDDR |= (1 << LEDBIT); // set LED pin as an output
TCCR1B |= ((1 << CS10) | (1 << CS11)); // configure timer prescaling
@holachek
holachek / Makefile
Created August 9, 2012 14:53
AVR Tutorial Makefile
# Name: Makefile
# Author: <insert your name here>
# Copyright: <insert your copyright message here>
# License: <insert your license reference here>
# DEVICE ....... The AVR device you compile for
# CLOCK ........ Target AVR clock rate in Hertz
# OBJECTS ...... The object files created from your source files. This list is
# usually the same as the list of source files with suffix ".o".
# PROGRAMMER ... Options to avrdude which define the hardware you use for
@holachek
holachek / main.c
Last active September 8, 2021 11:29
AVR Tutorial main.c
#define F_CPU 1000000 // CPU frequency for proper time calculation in delay function
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRD |= (1 << PD6); // make PD6 an output
for(;;)