Lesson 3

Goal

Today we will learn a new way to output through the Arduino pins using the tone() function.

We will also learn how to recieve input through an Arduino pin and to send debugging information back to a PC.

BONUS: If we do well we can combine both of these to make a musical instrument called a "Theramin".

New Arduino Functions


tone(pinNumber, frequency)

Sets a pin to continuously turn on and off at a given number of times per second.


noTone(pinNumber)

Suspends any tone currently playing through a given pin.


Serial.begin(baudRate)

Opens a serial channel on the given baud rate (use 9600) which we can use to communicate with other devices like our PC through the USB connection.


Serial.println(message)

Sends a message over a previously opened serial channel. Use the Serial Monitor to recieve messages.


analogRead(analogPin)

Checks the given pin and returns a value for the current it is currently recieving 0-1023.

Schematic 1

Schematic 2

Schematic 3

Homework