Active Buzzer Arduino Tutorial #5 - Elegoo Uno R3 Basic Starter Kit

preview_player
Показать описание
In this video I use the buzzer to create a variety of different sounds with the Arduino Uno R3.

The Elegoo Arduino basic starter kit is a really good and cheap piece of kit, allowing anyone to quickly get started using Arduinos and Breadboards. I particularly enjoy the tutorials the company has created to use along side their kits. In this video series I will complete all the tutorials for the Basic Starter Kit.

Subscribe for more as I'll be posting a lot more Arduino content.

_________________________________

Hi, I'm Hamed, an Electrical & Electronics Engineering Student in Leeds, UK.

Stuff You May Have Seen In My Videos

You Can Also Find The Above For Cheaper On Banggood/Aliexpress
Рекомендации по теме
Комментарии
Автор

thats the exact sound i needed for one of my projects you have very help full videos.

williamchupin
Автор

omg the videos u make are so help full

williamchupin
Автор

changing the loop will not change the sound, only the length of it, loop 80 times 1 delay+1 delay= 160 milliseconds... also the whole thing is embedded in a while(1) meaning while true=forever loop, so that first loop will play for like 160 milliseconds, the 2nd one just have delay 2 twice so it'll be just twice as long... i

changing the length of the loop will not make a significant difference in the pitch of sound itself

also changing the delay by just 1 will again not make huge difference,

you should change the delay especially between high/low more drastically if you want to hear difference, 10, 20... 50 or even 100,

turning on/off buzzer for 1 millisecond or 2 milliseconds you you won't hear the difference...

you have to make bigger delays, for example try loop only 50 times, but make the high/low delays add up to 20 (that would be 50*20=1000ms =1 second), for example
set high buzzer than wait 5 millisecond (delay 5) then turn it off and wait 15 (delay 15) you get 5+15=20
or the other way high for 15, low for 5...


or try 20+30=50 then you only need a for loop i<20 to get 1 second sound

the two loop was inside a while(1) loop which repeats forever, so changing there made 0 difference... yes delay 1 or delay 2 there is a tiny difference that is why you hear some vibrating buzzing, but if you want real difference change the delay, and play with it..

make the first loop delay 7+delay 32 .... for 100 repetition
make the 2nd loop delay 29 + delay 30 for 200 repetition

and you will see a big difference, first loop will go for 39*100=3900 (3, 9 seconds at least)
2nd loop will go 29*30=290*3=870ms=0.87 seconds at least and should be a different sound (as much the buzzer can sound different at all)

Yes these delay seconds/milliseconds I mentioned will be not 100% not accurate, because the loops have not only the 'delay' but the buzzer sets and loop condition has to be evaluated too, also i need to be incremented..these all can take up some time, so for example a loop like
for i=0; i<1000; i++ {delay 1}
not necessary takes 1 second, do you waited 1 milliseconds 1000 times, but running the loop itself takes time, incrementing i, etc. as I just said

Cruze
Автор

Come on there is even comments in the code...

read the comments they start with //

behind delay it says "Wait for 1 ms" .. and that code, maybe surprising for you ...what it does is: the program stops and waits 1 for millisecond

that is NOT changing the pitch, you are hallucinating... the program method DELAY only WAITS/PAUSES the program for a certain time,

You turn on the sound, then "DELAY will wait 100 seconds.

your very last code 15:47 all it does same as before but the turn on beep and turn off beep is 100 seconds - 100 seconds long, there is no pitch change.

Cruze
Автор

Hey what’s up, I got the kit but where do u get the code?

alvarojimenez
Автор

This was made a day ago and I got this kit a day ago lool

followmeonttcanuseeallthee
Автор

Also adding to my previous comment. Change only ONE variable it will be easier to find what is going on....
you change delay to 10 after you set the buzzer high. and you don't test it, but right away you change the 2nd delay (after setting buzzer LOW) to 10

why are you changing TWO variables (sometimes you even changed 4)...

there is no logic in the way you changing those for loops, delays... you completely randomly change 2 or 4 numbers instead of just changing 1 variable.

Change 1 at a time, load up, and test it, and you will understand it better.

you did at the end set high then delay to 1000, low then wait again 1000 ms, and you think its like a beep-gap-beep-gap sound but no, because there is a 2nd and 3rd loop too so its more like beepzt-gap-beepzt-gap... where 'zt' means an other sound..

but clearly you don't understand how these sounds are made because you are changing too many variables at one time

Cruze