To make your electronic projects even more interesting, in this block you will learn about the magic of analog signals and the serial port. By the end of this block you will know that there is actually nothing magic about these technologies themselves. What is magic is what you create with it. Among other projects, in this block you will find a cookie guarding monster, a music playing pencil and a knocking skeleton in a coffin.
Category Archives: Concepts
Reading analog signals
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; an LED is either on or off.
Continue reading
Writing analog signals
Just as you can read analog signals, you can also write analog signals. Arduino uses Pulse Width Modulation (or PWM) pins to write analog signals. Check out the digital pins with a tilde symbol (~) next to them.
LDR
The Light Dependent Resistor (LDR) is an analog 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 could use it to make a robot that follows light, or a lamp that automatically turns on when it gets dark.
Continue reading
Continue reading
Serial port
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 you can send or receive text.
Continue reading
Continue reading
Sending to computer
To send a message from the Arduino to the computer, you will need 2 commands:
Continue reading
Serial.begin()
and Serial.println() or
Serial.print()
.Continue reading
Receiving from computer
To receive data over the Arduino serial port you need two commands:
Serial.available()
and Serial.read()
.