• Tone() with 8-bit volume control - No additional components!

QC

Tone() with 8-bit volume control - No additional components!

Using PWM frequencies from ultrasound, the Arduino can now produce square tone waves() with 256 volume levels with nothing but a speaker!

Devices and components

Arduino Uno Rev3

Speaker: 0.25 W, 8 ohms

Project description

Set output to HIGH

Wait 1136 microseconds

Set output LOW

Wait 1136 microseconds

analogWrite(output, 127);

Wait 1136 microseconds

analogWrite(output, 0);

Wait 1136 microseconds

Timer 0:

Timer 1:

Volume Library

The Volume library is also available through Arduino Library Manager!

Downloadable files

Connection guide

Connection guide

Connection guide

Connection guide




Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.

Arduino Tutorial: Mini Piano

In this video I show you how to make a mini piano with Arduino. Devices and components Arduino Uno Rev3 Jumper wires (generic) Buzzer Breadb...