User Tools

Site Tools


arduino_sound

If you want to send us your comments, please do so. Thanks
More on comments


Sound

Warning: A port of the Arduion (ATmega 328P) can only supply 40mA. So make sure there is a resistor of at least 150 Ohm in series with the speaker
You can also use an amplifier with the speaker
A piezobuzzer does not need a resistor. The sound is not as good as that of a speaker

With tone() a sound of a certain frequency and duration can be played
While the tone is playing the program continues
You can use a delay to make the program wait for the tone to be finished

int tonePort = 12;
int frequency = 1200;
int tonetime = 700;
tone(tonePort, frequency, tonetime);
delay(tonetime);

With notone() the playing can be stopped before tonetime is reached
If tonetime is ommitted the tone is played “forever” or until stopped by notone()


Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2024 Webevaluation.nl and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
arduino_sound.txt · Last modified: 15-02-2020 15:05 by wim