January 2012

by

by

Making (Typesetting) Matrices in LaTeX

Below is code demonstrating how to typeset matrices in LaTeX using the array environment. \begin{displaymath} Q = \left( \begin{array}{ccc} q_{11} & q_{12} & q_{13} \\ q_{21} & q_{22} & q_{23} \\ q_{31} & q_{32} & q_{33} \\ \end{array} \right) \end{displaymath} The code generates a three column matrix with the contents of each column centered ({ccc}).

by

Introduction to Arduino Interrupts and the ATmega328 Analog Comparator

Interrupts are exactly what they sound like. They are events that cause a microcontroller’s CPU to stop executing a main program in order to execute a snippet of code on the side. As an example, here I discuss how the analog comparator on the ATmega328 (Arduino Uno) can be configured to generate an interrupt. Let

by

How to Configure Arduino Timer 2 Registers to Drive an Ultrasonic Transducer with a Square Wave

The Arduino IDE has many built-in commands to produce PWM outputs but directly setting the timer registers gives you much more flexibility and power. Below I show how to configure the 8-bit Timer/Counter2 on the ATmega328 (Ardunio UNO) to generate a 40 kHz square wave on Arduino digital pin 11. Why 40 kHz? I want

by

Making HTML Color ASCII Art with MATLAB

On one warm spring afternoon during grad school when I should have been outside enjoying nature, I stayed in the lab and wrote the following MATLAB script. It will take any 8-bit RGB image and convert it to colored HTML text; any text. As an example of its application I have emblazoned my favorite positronic