User:Tamas Bates/RWRM/HW1

From XPUB & Lens-Based wiki
Approximation of Triangular Crystal Growth

A small program written in Javascript to create fractal-like images made of triangles in a user's web browser. The sequence begins with a single "seed" triangle, created and positioned near the center of the viewer's screen as part of the program's initialization. From each of the triangle's corners a new, slightly smaller, triangle grows out along an axis which bisects the corner it was created from. This process is continued for each of the new "child" triangles and their resulting children, with care taken to avoid growing new triangles which overlap any existing triangles. After some time, the resulting final shape is approximately hexagonal (though not all sides are of equal length) and contains many pseudo-hexagonal pockets, some of which are filled with spiralling intrusions of ever-shrinking triangles.

Booze Bot

An Arduino Uno connected to a bank of relays wired up to the power switches on several small vacuum pumps. Each pump rests in a cardboard frame on top of a milk crate, which has the open side facing the user. A funnel beneath each pump routes fluid into the crate, depositing any liquid into a larger funnel balanced above a drinking glass. The input side of each pump is connected to a length of rubber tubing, which is inserted into a collection of liquors. Pressing a button connected to the Arduino activates the pumps and produces a cocktail for the user.

HOW

The vacuum pumps were taken out of a set of breast pumps which ran on DC power. Each of them had their input voltage line soldered to a relay connected to the arduino. Through experimentation the speed at which liquor could be moved by the pumps was determined and hard coded on the arduino. To fonstruct a cocktail the program loaded a file containing a list of the ingredients available at each pump, and how much of each was required for the drink. It would run each pump corresponding to the needed ingredients for a short interval which was computed from the pumps' measured flow rates to extract the correct amount of each liquid. The button was simply connected to a digital input pin on the arduino which the triggered the program to make a single drink.
Lightning Bolt Generator

A small program written in Lua. It begins by drawing a solid black background on the user's screen. At the top of the screen a clump of colored pixels forms, white at the center and fading to dark purple and black at the edges. These expand downward in an erratic fashion, carving out a jagged path toward the bottom of the screen, occasionally branching out into some smaller paths during the descent. The result is like watching lightning strike in slow motion. At any time the user can restart the process to generate a new and different lightning bolt.