Input/Output Activities and Notes:
Since our last meeting you have hopefully played with your Arduino a little and gotten familiar with the various electronic items in your kit. This time we will begin the process of learning how microcontrollers get input from the outside world, make decisions based on that information, and then execute some action as a result. Our goal here is to get the Arduino to notice when we push a button and turn an LED on or off as a result.
Before we actually moved into that discussion we spent some time illustrating the meaning of PWM (pulse width modulation) using an oscilloscope to visualize what the Arduino output drivers are doing. We discussed how this gives us the ability to dim an LED or slow a fan motor. This is different than how we used to dim incandescent light bulbs in our houses which provided some insight as to why LED bulbs require different mechanisms for dimming.
We spent some time making sure that we understand how the breadboard used for wiring up test circuits works and how to use it to turn an external LED on and off (as opposed to the onboard LED on the Arduino). In this discussion we also developed some understanding of the limits on the output pins of the Arduino and how we use resistors to control and limit the current demands on the output pins.
Finally we discussed and illustrated how to write code in the sketch that allowed us to 'debounce' a push button switch. All of the inputs and outputs this time were digital in the sense that they were either 'ON' or 'OFF'. A useful extension of this idea is Jeremy Bluhm's nightlight sketch which creates a sequence of colored lights which is stepped through in response to the push of a button.