// constants won't change. They're used here to // set pin numbers: const int buttonPin1 = 2;     // the number of the pushbutton pin const int buttonPin2 = 3;     // the number of the pushbutton pin const int buttonPin3 = 4;     // the number of the pushbutton pin const int speakerPin = 11;    //the number of […]

Identifying resistors by color bands If you have just purchased a resistor it will generally come with some sort of label, but that doesn’t help if we find our resistor sitting unaccompanied on a table or in our parts box. Fortunately, every resistor has a set of color bands printed on its casing which tells […]

Sensors and variable resistors In the last chapter, we learned how to put buttons into a circuit to play notes through a speaker and to turn an LED on and off. Now we’re going to learn how to attach sensors to a circuit and use the information we gather from them to create more subtle […]

Step by step potentiometer LED circuit The first circuit we will build will contain a potentiometer that will control the brightness of an LED. You’ll need these parts: 1 LED 1 220 Ohm resistor (red, red, brown, gold) 1 10K Ohm potentiometer Jumper wires Breadboard Arduino Uno USB A-B cable Computer with Arduino IDE We […]

What Role Does the Sketch Play in Our Circuit? You’ve seen the circuit in action, so you understand what it does, but how does the Arduino translate the potentiometer’s resistance value to a brightness value for the LED? To figure that out, let’s take a look at how electricity and information flow through our circuit. […]

ATG6_AnalogSerial sketch This Arduino sketch reads the value of voltage on pin A0, translates it to a value the LED can understand, and then sends it out to pin 9. As is other sketches we have seen, there is an initialization section, a setup() function, and a loop() function. Here’s a screenshot of the sketch. […]

Analog input: values from the potentiometer The first line of code has the Arduino check the value of voltage coming in from the potentiometer on pin A0. This value is stored in sensorValue. How is the changing resistance of the potentiometer affecting the values coming out of pin A0? If we were to use a […]