CHRISTOPHER BARTHOLOMEW: So you've probably been hearing a lot about Arduino, and all the brilliant ways it could be programmed using C to receive input from peripheral devices like buttons, sensors and knobs. Or display and control output through physical components like lights, speakers, servos and motors. But what is an Arduino, really? An Arduino is a type of microcontroller, and a microcontroller can be thought of as a very scaled down computer which contains components such as a processor, small amounts of memory for storing simple programs, and various input/output pins that produce an electrical current as a result of instructions in your program. The pins on an Arduino are here to interface with the physical components such as LEDs, speakers, sensors, motors, and so much more. This is an Arduino Uno R3 which we'll be using throughout the course. In this video, I'll be going over just some of the main components of this board. However, if you'd like more information, which I recommend you read, visit the link for the Arduino Uno's full specification. Power for the board can be received from USB, external AC to DC power supplies, or by battery connectors. For these video exercises, we'll be using USB for power. If you're interested in other ways to provide power to your Arduino board or want to know more about the power pins, please refer to the power section of the specification link provided. Next, there are two main pin sections on an Arduino that we will use to provide voltage to our components-- digital pins and analog input pins. Before we go any further, let's understand these two terms. Analog input pins are for components such as knobs, which create analog signals. A knob can provide different amounts of resistance to voltage between the two pins that it's connected to. Take, for example, a light dimmer. As the knob is twisted in one direction, the light will become brighter because the resistance lessens. This provides a stronger electrical current to the component, which results in a brighter light. Now the digital pins are slightly different in that they produce a digital signal that is dependent on the amount of voltage across the pins. Digital signals for the Arduino are either on at 5 volts, or grounded meaning off, or zero volts. Take for example a light switch. A light switch has two values-- on and off. When you turn the light on using the switch, you're providing full power to that light. Well, on the subject of digital and analog, I'm sure you've noticed by now the acronym PWM under the digital pin section. This stands for Pulse Width Modulation. PWM manipulates the voltage over time to produce modulation effects that are similar to those of the analog pins. For example, by turning a light on and off rapidly for different lengths of time, it can control the light's brightness. So you might be asking yourself, if all you have to do is provide some voltage to some component for it to work, why even have a microcontroller? Well, let's take a high-level look at a microcontroller that we may interact with daily-- the alarm clock. The alarm clock has many inputs, for example buttons, which are used to interact with the alarm clock program. It also has outputs which are light emitting circuits called seven segment displays that show the time. This is all controlled by a program that is contained in a microcontroller's memory. Now, let's take a look at a scenario and see if we can replicate the alarm clock with this Arduino. You're ready to go to sleep, but you'll need to set your alarm to wake up. We know that by using some buttons we can set some variable, time, that gives the program a condition it must meet. Such as, when this time is true, the program should send a signal to another pin that is connected to a speaker. And when this signal is received by the speaker, it should play an awful sound. Let's use a simple circuit to give you some context to what I'm talking about. So now that your alarm is set, your condition is now stored in the program's memory. And after only nine seconds of sleep, you hear the awful alarm sounding away. I'm going to go ahead and plug-in our alarm here. Now, we don't want to get up quite yet, so we feel for the snooze button. We let the sleeping student halt, or interrupt this awful alarm sound, by just hitting that button. But what really happens when the microcontroller's program receives a signal from the snooze button? Well, when the snooze button is pressed, a signal is received on a different pin. In general, when the program receives this input from the pin it reacts by calling some function to delay, or sleep, the signal that was sent to our speaker pin. This delay or sleep is for some constant time which usually is about nine minutes, or in Arduino terms, 540,000 milliseconds. If the alarm clock isn't switched off before the snooze timer depletes, the program's condition will send another signal to the speaker's pin, thus turning the alarm on again. Now, what makes Arduino special to cs50 is its development environment uses the C language, giving you the power to apply knowledge gained in a more direct hands-on way. Although we did not touch upon the other special pins involved with the Arduino, I recommend that you visit the specification and read about their capabilities further. In another video, we will explore the Arduino development environment on the cs50 appliance and write our first microcontroller application. My name is Christopher Bartholomew, this is cs50.