# teaching machines

## Hot vs. Cold Inlets

This post is part of a series of notes and exercises for a summer camp on making musical instruments with Arduino and Pure Data.

### Summer Camp

Let’s start with a patch that adds two numbers and shows their sum. Using three Numbers and one Object, create this program:

Connect up the outlets and inlets as shown.

Leave Edit Mode and experiment by dragging on the number inputs. What do you notice? Be thorough, and you are bound to discover something interesting…

Let’s compare our findings.
Dragging on the left inlet causes the output to update the sum as we’d expect. However, dragging on the right inlet does not update the sum. Peculiar, eh? What gives?

This mismatching behavior is how Pure Data is designed. The first inlet to an object is called the hot inlet. All others are cold inlets. Changes on hot inlets force downstream updates. Changes on cold inlets do not.

By making only the left inlet hot, we are less like to activate an object that is in an incomplete state. Imagine making every seat in a car “hot”, each having its own a steering wheel. We’d have some “wheel twubble.”

### Dealing with Hot/Cold

Sometimes we do want cold inlets to trigger downstream updates. One workaround to is to add a bng object:

After we change the second number, we just press the bng button to reissue the unchanged first number—which causes the sum to update. This bng fixes our update problem, but it is annoying.

A better solution is to use a trigger object. When a value enters the inlet of a trigger, the trigger fires off a sequence of values through its outlets:

The trigger here spits out a bang and a float. Importantly, it does so in reverse order. First, the float outlet sends the number along unchanged to the cold inlet of the plus object. Second, the bang outlet sends a pulse to the hot inlet of the plus object.

As you can see, a trigger can make a cold inlet behave like a hot inlet. This dynamic of hot vs. cold will be important to remember throughout the week. We’ll see trigger again.