The Learning Circuit s01e12
Titre original : Arduino Starter Kit: Spaceship Interface
For this project you’ll need an Arduino Uno the USB cable to plug into your computer, breadboard, jumpers, a tact switch, two red and one LEDs, three 220 ohm resistors for the LEDs, and one 10 kiloohm resistor. The code you’ll need to do this project is included in the Arduino Starter Kit book. The Arduino Starter Kit book includes circuit diagrams and code which is referred to as sketches. A sketch includes a set of functions followed by curly brackets, such as void setup () and void loop (). Anything you put in the curly brackets is the code that is executed when the function is called. Sometimes you will need to create what are known as variables for your code. A variable are items that you want your code to remember so that you can reference them later. One good thing about variables is that if you use the same variable throughout your code and need to adjust the value of the variable, you only need to set the variable to another value at the top of the code. Karen shows you how to set an integer as a variable for the project. After defining the variable, Karen moves along to the setup code. The setup is where we configure the pins so that the Arduino knows what’s an input, what’s an output, and which pins we’re using. In her code the 3 LED are designated as outputs, for pinMode, and the button is designated as an input for pinMode.