A simple buzzer example using analogWrite /* Example 13.0 Drive a piezoelectric buzzer with Arduino http://tronixstuff.wordpress.com/tutorials > Chapter 13 */ void setup() { pinMode(8, OUTPUT); // sets the pin as output } void loop() { analogWrite(8,128); delay(500); digitalWrite(8, LOW); delay(500); } analogwrite buzzer piezo ton