Data Sheet

Core Spartan Documentation Modern Robotics, Inc
Version 3.0.3 Page 52
void setPitch(int frequency)
The pitch controls how high or low the sound of the tone will be. The sensor
operates between 1Hz and 5kHz (5000Hz) and it resonates at 2kHz, so the sensor
will sound its loudest at this frequency.
beep.setPitch(100);
beep.setPitch(2000);
beep.setPitch(4500);
void setDuration(int length)
The duration is the length of the tone. The duration has a range of 10 ms 2550
ms in 10 ms increments. The duration is a countdown internally, therefore
duration can be updated to extend the time of the tone.
beep.setDuration(10);
beep.setDuration(1000);
beep.setDuration(2550);
int getDuration(void)
Returns the amount of time remaining in the current tone being played up to
2550 ms. Therefore, if the duration left on a tone is over 2.55 seconds, the
returned value will remain at 2550.
value = beep.getDuration();
…or…
Serial.println(beep.getDuration());
void setSound(int level, int frequency, int length)
This function allows the user to set the volume, pitch and duration all in a single
call.
beep.setSound(LOW, 1350, 100);
beep.setSound(MAX, 2000, 255);