To make your electronic projects even more interesting, this week we will teach you the magic of Analog signals and the serial port. In the end of this week you will know that there is actually nothing magic about these technologies themselves, what’s magic is what you create with it. Among other projects this week you will find a cookie guarding monster, a music playing pencil and a knocking skeleton in a coffin.
As you have learned previously, digital signals only have two opposite states: 1 or 0. For example, if you push a button, its state changes from one to the other; a LED is either on or off.
Just as you can read analog signals, you can also send analog values. Arduino uses Pulse Width Modulation (or PWM) pins to send out analog values. Check out the digital pins with a tilde symbol (~) next to them.
Now we’re going to learn about a special analog sensor. The Light Dependent Resistor (LDR) is a sensor that detects the amount of light present. Depending on the amount of light shining on it, the sensor will return a specific analog value. You can do something really interesting things with it; make a lamp that turns on automatically when the room gets dark or a robot that follows flashlight. So, let’s get started with the basics.
Arduino boards connect to your computer using a USB cable. The way the boards “talk” to the computer is through something called a serial port. Serial ports can be used to exchange fairly complicated data with the computer. Instead of the digital or analog signals we discussed previously, you can send or receive text (
You can use
Serial.read() to get data from the Arduino serial port.