User Manual

Code Analysis
analogWrite(BuzzerPin, Value);
Description:
Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses
or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady
rectangular wave of the specified duty cycle until the next call to analogWrite() (or a call to
digitalRead() or digitalWrite()) on the same pin.
Syntax:
analogWrite(pin, value)
Parameters:
pin: the Arduino
pin to write to. Allowed data types: int.
value: the duty cycle: between
0 (always off) and 255 (always on). Allowed data types: int.
Writes an analog value (PWM wave) to the Buzzer.
Demo Effect and Serial Print Result:
The buzzer beeps 3 times fast at startup, waits a second then beeps continuously
at a slower pace.
Breakout Guide
Use a Grove cable to connect the Grove Buzzer to Seeeduino Lotus’s digital interface D5.
27
Grove Beginner Kit For Arduino®