Arduino Tutorial 23: Changing Tone of an Active Buzzer

Sdílet
Vložit
  • čas přidán 12. 08. 2019
  • You guys can help me out over at Patreon, and that will keep this high quality content coming:
    / paulmcwhorter
    If you want to control tone in a buzzer it is best to use a passive buzzer, but in this lesson we show how you can adjust the tone a little bit in an active buzzer.
    You can get the kit I am using for this series at the following link:
    amzn.to/2I7N4Ek
    You can follow along at home by checking out our WEB site HERE:
    toptechboy.com/arduino-tutori...
    [Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. This means if you visit the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.]
    #Arduino
  • Věda a technologie

Komentáře • 106

  • @dougnash6316
    @dougnash6316 Před 5 lety +33

    I just added my Patreon support for Paul. Only $5 bucks a month and worth way more than that.

  • @GDub1958
    @GDub1958 Před 4 lety +31

    Paul, I can say that entering everything out each new lesson, is programming my memory more then the "mindless" act of copy & Paste, everything Paul does serves a purpose, so after a few hundred hours (6 or 7 years) of watching Mr. McWhorter teach there are actually very few actual mistakes guys and gals! BOOM
    However for me, "My Dreams Are Becoming A Reality", because I am learning "How to CODE" and remember "How to CODE"! Thanks Paul

  • @libbytardalo2071
    @libbytardalo2071 Před 3 lety +26

    I am loving this!
    Can't help but notice, that the watch count keeps dropping as the lessons progress.
    Buncha quitters.

    • @rawadhasan9111
      @rawadhasan9111 Před 3 lety

      Maybe they're waiting for summer break or winter break

    • @EliteGamerSquad
      @EliteGamerSquad Před 2 lety

      ​@@rawadhasan9111 I'm in the middle of school and still watching them

  • @alicewang6342
    @alicewang6342 Před 3 lety +7

    Paul, you must read my mind!!! At the end of lesson 22, I was thinking to myself how to make the buzzpin to have a certain number of sounds as the LED blinked. I checked the notes that you taught us to use For Loop to set the number of blinks. Then BOOM! You taught us in lesson 23!!!

  • @brentspeetzen2427
    @brentspeetzen2427 Před 3 lety +7

    These tutorials are extremely well done and very informative. Thank you, Paul!

  • @vu125
    @vu125 Před 5 lety +8

    I would love to like your videos more than 1M times. Thank you so much for teaching us. God Bless you. :)

  • @danbishop4035
    @danbishop4035 Před 4 lety +1

    Working my way through...I appreciate all of your lessons.

  • @Eternalshammy
    @Eternalshammy Před 2 lety +2

    Dear Mr. Paul,
    I am from Greece, I drink coffee when I watch your videos (with sugar though) Thank you for these videos !
    I bought the ELEGOO UNO R3 you have suggested and I wanna say that, It is exactly what I need for my projects :)
    Please keep up your good work!

  • @DaljeetSingh-yv7ch
    @DaljeetSingh-yv7ch Před 2 lety

    just got back to your lessons after a few months because of school, and they are still awesome.

  • @paulusbouma9192
    @paulusbouma9192 Před 5 lety +2

    I used the circuit we built in the last tutorial and imbedded the 2 for loops in the while loop used in the code associated with that circuit. The two-tone buzzer turns on and off as expected when I adjust the potentiometer. Adjusting the delay time variables also produces interesting results. Looking forward to the next tutorial! Thanks for your efforts.

  • @michaeljenkins2345
    @michaeljenkins2345 Před 3 lety

    Still here, Mr McWhorter. Ready to get back into these lessons! Thank you so much!

  • @aynursunagatullin7029
    @aynursunagatullin7029 Před 3 lety

    Thank you Mr. McWorther, this was very fun and interesting

  • @gweliver
    @gweliver Před 5 lety +1

    Very nice tool to have in my Arduino library! 2-tones attracts my attention more and it’s a lot more professional for projects!
    Thanks Paul

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +3

      Good deal. Worry these buzzer videos are a little boring, but need to get all the basic components out of the way first.

  • @CarolMartinYoutuable
    @CarolMartinYoutuable Před 2 lety

    Thanks for another great lesson Paul

  • @erichholzer9976
    @erichholzer9976 Před 3 lety +4

    Enjoyed this tutorial. You should note that the counter variable for the for loop can be declared and initialized in the setup of the for loop. i.e. (for int j = 0; j < someNumber; j++) {loop code}.

  • @philnewman1110
    @philnewman1110 Před rokem +1

    Great video as always Paul, thank you so much!

  • @MrDelta22
    @MrDelta22 Před 3 lety

    Congratulations! You the first one in a buzzer lesson who actually managed to peal off that white seal from the active buzzer. I wonder why all the others were so reluctant to do so.... :-)

  • @aaronmilliman7685
    @aaronmilliman7685 Před 2 lety +1

    I acted like a little kid with the buzzer..... my wife wants to know if you teach any classes on growing up and becoming more mature.....
    Another great lesson!

  • @JohnJones-oy3md
    @JohnJones-oy3md Před měsícem

    0:16 - Almost five years later and how he pronounces 'Elegoo' still makes me chuckle a bit. Can't fault him, 2019 was early days.

  • @mester.mechanic
    @mester.mechanic Před rokem +1

    thanks paul

  • @theteenengineer7589
    @theteenengineer7589 Před 5 lety

    Very nice explanation!

  • @Hino_55
    @Hino_55 Před 4 lety

    Thank you Sir Paul!

  • @lorisrobots
    @lorisrobots Před 2 lety

    Still here and learning ... thx!

  • @MarcReeveNewson
    @MarcReeveNewson Před 3 lety

    Still at it, and a friend of mine just got his kit and started on the lessons.

  • @utsavgoyal6658
    @utsavgoyal6658 Před rokem +1

    Amazing as usual

  • @tameraziz2104
    @tameraziz2104 Před 4 lety

    Thanks Paul.

  • @dannycollins5698
    @dannycollins5698 Před rokem

    💥
    Thank you again!

  • @erygion
    @erygion Před 4 lety

    Nice quick one here but this is good thank you, I was wondering if this was possible. 😊

  • @philgames8415
    @philgames8415 Před 3 lety

    Awsome, thankyou

  • @MirceaCK
    @MirceaCK Před 4 lety +1

    Hi Paul!. You can teach ´char´. "int" is not needed for such low numbers (lower memory space for char vs int). Programmers must be efficient And "j++" would be a nice trick too.

  • @dimpledharamsi7704
    @dimpledharamsi7704 Před 2 lety

    hi!
    I tried with a couple of other delay times and it gave variations in the sound output. Thank you for teaching me this!

  • @Eternalshammy
    @Eternalshammy Před 2 lety

    Thanks!

  • @opalprestonshirley1700

    It's not Classical but it works! Thanks Paul have a good one.

  • @maksymchumak9680
    @maksymchumak9680 Před 2 lety

    Paul, Thank you for making these videos!
    I'm only 11 and I know how to do an arduino!

    • @paulmcwhorter
      @paulmcwhorter  Před 2 lety

      Excellent! You are very far ahead of most people your age. Keep up the hard work and you will go very far in your life. Maybe you will even change the world.

  • @advancedperformance9721

    Thank you sir

  • @matthewgroves3671
    @matthewgroves3671 Před rokem +1

    my Girlfriend hates this buzzer, Time to figure out how to automate annoying her with it lol thanks again Paul, What Coffee do you like?

  • @muhammadrafiqulislamkhan6994

    You are wonderful. My request you to make another video about millis. God bless you. Thank you.

  • @DJL7777
    @DJL7777 Před rokem +1

    Hi Paul, I have a question! Maybe I'm getting a little ahead of myself but when you use an if(....){
    digitalWrite(buzzer, HIGH);} and then writing delays and more readings to turn it off again, could you instead use an ELSE statement and in there say basically everthing under potVal 1000 digitalWrite(buzzer, LOW)?
    If been reading a little into Arduino commands and the else statement seems to be usuefull in these cases.
    Cheers and thank you very much for these wonderfull lessons!
    Davy

  • @tinnguyen1375
    @tinnguyen1375 Před 4 lety

    Paul and guys, I have a question: as we define output pin number, we use integer. Is it better to use constant as the pin number does not change while the program is executed? Thanks

  • @karelenmarritkruyswijk393

    Nice short lesson. No coffee needed ☕...

  • @jakobmlakar5680
    @jakobmlakar5680 Před 3 lety

    The part when you didn't know if your code was flawless was funny 😂 (5:25).

  • @tinnguyen1375
    @tinnguyen1375 Před 4 lety

    hi Paul, I just rekcon the delaytime is actually half of the time cycle, isn't it?

  • @Dieselfitter01
    @Dieselfitter01 Před 5 lety

    Paul. Your content is awesome. Are you giving up on this project? I have that exact kit and always look foreword to your next challenge.

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +3

      Do I look like the kind of guy that ever gave up on anything. Remember, I had the tutorial series "Learn Fusiohn 360 or die trying". No lots more videos in the series. I will release one from this series a week, on Tuesdays. Then on thursdays I am releasing one lesson a week on the new 9-axis project. and then will do live shop talks on Weds. when I have time.

    • @Dieselfitter01
      @Dieselfitter01 Před 5 lety

      @@paulmcwhorter You are one incredible man. Thank you for everything you do for everyone.

  • @vijaygharat2968
    @vijaygharat2968 Před 4 lety

    hello sir i have to buy kit but we will use all the product in it

  • @tommyh4049
    @tommyh4049 Před 3 lety

    Does anyone know of a way to output tone on 2 pins but have a change of tone duration or frequency if both pins are shorted together. Similar to a fluke pro 3000 with smart tone technology.

  • @Abhi-ty2ew
    @Abhi-ty2ew Před 2 lety

    3:09 I literally screamed NOOOOOOOOOOO!!!!

  • @basiceducation1131
    @basiceducation1131 Před rokem

    Hi sir please tell a program for face engine sound module.with sound variation with increasing input voltage to Arduino

  • @tinnguyen1375
    @tinnguyen1375 Před 4 lety

    one guy suggest us to use this function for the buzzer: tone(pinNumber,frequency,time); I tried that and reckon the sound was interrupted quite a lot while I adjusted the potentiometer, especially when I tried to SerialPrint the real-time frequency / cycle time. I guess this is because the arduino cannot handle many activities at the same time. Is that right? thanks for any explanation.

    • @BigTurtleMane
      @BigTurtleMane Před 10 měsíci

      It’s been years and no one answered u 😕 Did u ever find out about this?

  • @joelarthur1865
    @joelarthur1865 Před 2 lety +1

    int A0 = 0;
    int tmp = 0;
    int buzzPin = 11;
    int LED = 13;
    How do you fix the conflicting declaration 'int A0'

    • @michaeltanner4404
      @michaeltanner4404 Před 2 lety +1

      Not really sure what you are asking here, but from this little code snippet, there is no conflict. If you only put this code in your project and try to upload it, you will not get an error message (ok, you might get one that says the variables are declared but not used, but that isn't a conflict). If you can explain a bit more what you are getting, or better yet post your entire code, maybe someone can help.

  • @dougnash6316
    @dougnash6316 Před 5 lety

    Hi Paul, I was looking forward to the next lesson. Is everything OK?

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +1

      Yes, the live stream was this morning . . . did you miss it? Make sure on your subscription to this channel that you click the bell so you will get notifications.

  • @umiturgutaswwsa
    @umiturgutaswwsa Před 2 lety

    How can I change the tone of music with arduino?

  • @ss-fk4zj
    @ss-fk4zj Před 3 lety

    Why did we use two for loops here???.... Which one did the buzzer choose??

    • @michaeltanner4404
      @michaeltanner4404 Před 2 lety

      It uses both of them. That is what makes the difference in the sound you hear. The buzzer stays on for longer in the second loop.

  • @Secret666
    @Secret666 Před 5 lety +1

    For loops are normally written slight differently than you have shown.
    for (i =1; i < 100; i++)
    Can I ask why you tend to use j as coding convention normally uses i and why you use j=j+1 when just using ++ is easier to type and also normally coding convention?

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +5

      i looks too much like an l or a 1. Can not tell you how many hours I see people spend pulling their hair out debugging code when the mistyped i, l, or 1. I think it is good practice to use variables that easily look different. hence, j is a distinct letter, and is one often used in loops.
      as far as j++ or j+= . . . those do not make as much logical sense. When teaching and trying to explain, or even writing readable code, j=j+1 it is perfectly clear what you are doing, and it is easy to explain, and people understand it better.

    • @Secret666
      @Secret666 Před 5 lety +2

      @@paulmcwhorter Thanks for the reply, yeah I see how that makes sense. This is why you are teaching and not me :) good job dude

  • @dougnash6316
    @dougnash6316 Před 5 lety +1

    I am a bit confused as to how dt1 and dt2 = different tones.

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +1

      It is like two different freqencies, so makes two different sounds

    • @dougnash6316
      @dougnash6316 Před 5 lety

      I guess I am having issues with the C language. Are these words that are distinct in the language? I have ordered the book Let Us C and the Solutions to try and get a handle on the C language but that will be a longer journey for me.

  • @wayneandrews1738
    @wayneandrews1738 Před rokem +2

    Playing music? Now that's different.
    Wayne

  • @alanfairclough3427
    @alanfairclough3427 Před 2 lety

    I am frustrated. I have got to the point where I cannot figure out how to change the com port on my serial monitor and the help thing does not show much that I can use. I am approaching the point where I pack everything up and include it in my next garage sale.

    • @paulmcwhorter
      @paulmcwhorter  Před 2 lety

      The computer assigns you your com port, and the arduino and serial monitor should be on the same port. You can not change it, and there is no reason to change it. It sets it, and then shows you what it is usting

    • @alanfairclough3427
      @alanfairclough3427 Před 2 lety +1

      Paul, thank you so much for the reply. For some reason I thought the board and serial monitor could not share the same port. I had an error message saying it could not compile for the board on com 4. I thought the com port was the problem. After much frustration I scrolled up the message to discover the real reason for the error. A period instead of a comma. You may want to mention to scroll up the error message window in case other newbies make the same mistake.
      My board is working great. I am moving right along with lesson 27. Thank you so much.

  • @jritzeku
    @jritzeku Před 5 lety

    The tutorials from here are are unavailable. How do I access them? Guessing you have to pay from here on

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +4

      Do I look like the type of guy who would charge for tutorials? They are released one a week. Be patient, grasshopper

    • @jritzeku
      @jritzeku Před 5 lety

      @@paulmcwhorter hahaha that's fair! thank you sensei for your tutorials!!! Jumping on to rasberry after this

  • @robertparker5369
    @robertparker5369 Před 5 lety

    Hey Paul, it's Friday and I still can't find your Thursday Lesson.... Is everything OK?

    • @robertparker5369
      @robertparker5369 Před 5 lety

      I thought you had stated earlier that you'd be releasing your Arduino Tutorials on Tuesdays and Thursdays for your followers.... Kinda looking forward to them.

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +2

      Based on feedback from participants in my live streams, a lot of people were wanting more advanced lessons. So this is what was decided. On Tuesday's I will release a lesson on the beginner tutorials as always. Then on Thursdays we will release a lesson on the 9-axis project. Then When I can on Wednesdays we will have a live shop talk session. So, three releases a week.

    • @robertparker5369
      @robertparker5369 Před 5 lety

      @@paulmcwhorter- What about your students that rely on learning the basics by doing your tutorials ... we might want to learn at a quicker rate than a lesson every Tuesday when we're used to the two lesson/week (with some homework) schedule. I'm in my 60's, retired and getting bored with the 'new' slow pace.... How about reconsidering your schedule and giving your junior students a bit more than one basic lesson per week? Two per week was just great and maintained my interest. One lesson makes me want to look somewhere else for this level of training.

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +3

      You have to remember that I have to work for a living and have a full time job. Each lesson takes many hours to prepare and produce. Hence, asking that I produce more is just not practical. Also, if I only release intro classes, then those with stronger skills wander off since they already know the basics. So, keep in mind that I do have to provide for my family, and hence do have to work at a real job.

    • @chrisingram7277
      @chrisingram7277 Před 4 lety

      @@robertparker5369 Hi Robert, I'm also in my 60's and have been binge watching the tutorials, I've only 4 more to go to be caught up and will have to slow down too. This is kind of a change from high school when education was more of a chore:)

  • @nishantparmar3774
    @nishantparmar3774 Před 2 lety

    how to possible only once time turn on buzzer after I will call then on buzzer, Please help me??

    • @michaeltanner4404
      @michaeltanner4404 Před 2 lety

      I'm going to need more information to answer your question. What exactly are you trying to do?

  • @dianawachira7410
    @dianawachira7410 Před 3 lety

    I don't understand where the condition that j

    • @michaeltanner4404
      @michaeltanner4404 Před 2 lety

      It's an arbitrary length of time that he choose. You could choose any number and change the length of each tone.

  • @dylansworld54321
    @dylansworld54321 Před 2 lety +1

    Can you give me the code please

  • @matthewcollins1858
    @matthewcollins1858 Před rokem

    present

  • @ArmenianDude88
    @ArmenianDude88 Před 3 lety +1

    Its painful to see the views slowly drop as the lessons go

  • @silverify
    @silverify Před 5 lety

    Or You can just use tone() and set frequency, done..

    • @aarickzook
      @aarickzook Před 4 lety +1

      As I understand it, tone only works on an passive buzzer, not an active buzzer.

  • @bearpapa1606
    @bearpapa1606 Před 3 lety

    Darn, everyone is knocking on my door asking me what happened.

  • @andrescaisedo2270
    @andrescaisedo2270 Před 2 lety

    im at 3:18 SEMICOLON!1!1

  • @geonerd
    @geonerd Před rokem

    BzzzzzzzZZZt!!

  • @lanberthou3585
    @lanberthou3585 Před 3 lety

    you can use "j++" instead of "j=j+1", just sayin'

  • @laweren100
    @laweren100 Před 5 měsíci

    I think i burned my buzzer on the last lesson.. all it does is click

  • @theteenengineer7589
    @theteenengineer7589 Před 5 lety

    Very nice explanation!