Can an ATtiny85 drive this buzzer directly from a digital pin? I'm not getting any sound out of it. Maybe mine is defective, or maybe there's another reason? It says 3-7 VDC and my ATtiny85 is running on 5VDC. and it only draws 30mA. Hmm, is that too much? It may be, but it should make a sound, shouldn't it. I don't have it installed backwards according to the datasheet.
Please post your full sketch. If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help. If the sketch is longer than the forum will allow then it's ok to add it as an attachment. Don't put your code in some external file service like dropbox, etc. We shouldn't need to go to an external website just to help you. I do feel it's reasonable to post a link to code hosted on GitHub or similar code hosting sites since that's an platform specifically designed for this sort of thing
Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor then you will not have access to this useful tool. I recommend using the standard Arduino IDE instead.
When your code requires a library that's not included with the Arduino IDE please post a link (using the chain links icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.
Yeah, it should be working. The "absolute maximum" current from an output pin is 40mA.
Does it make a sound when you connect it directly to 5V? If not I'd say it's defective.
SouthernAtHeart:
Can an ATtiny85 drive this buzzer directly from a digital pin? I'm not getting any sound out of it. Maybe mine is defective, or maybe there's another reason? It says 3-7 VDC and my ATtiny85 is running on 5VDC. and it only draws 30mA. Hmm, is that too much? It may be, but it should make a sound, shouldn't it. I don't have it installed backwards according to the datasheet.
IF you are sure the + pin is connected to 5 volts and the other pin is connected to the Arduino pin, then when the pin goes low, the piezo should sound.
OR, connect the + pin to the Arduino pin and the other pin to ground and when the Arduino pin is set high, the piezo will sound.
Finally, if you connect +5 volts to the + pin of the piezo and -5 volts to the other pin, no Arduino, the piezo will sound.
one of these will work,
Paul
AH, I was doing this:
tone(3, 1500, 2000);
So I just need to turn the pin on for this type of buzzer...