How do I use tone commands?

I have a Piezo Buzzer hooked up to an adafruit trinket 5V and i can't get it to make any sound without using the long melody example that the IDE website has set up. Is there any way to make it turn on and make just like an alarm sound?

What piezo buzzer?

If you have a simple piezo element then look at these:

https://www.arduino.cc/en/Reference/Tone

https://www.arduino.cc/en/Tutorial/toneMelody

.

I have a Piezo Buzzer hooked up to an adafruit trinket 5V and i can't get it to make any sound without using the long melody example that the IDE website has set up.

Make sure your tone() function 'points to' the same I/O pin as the melody example (the same pin your buzzer is connected to).

Also make sure the frequency is in a range that the piezo can reproduce and that you can hear. And, make sure the duration is long enough for you to hear something.

If that's not the problem, show us your code.