Data Sheet

Core Spartan Documentation Modern Robotics, Inc
Version 3.0.3 Page 51
9.6. Sound Generator (45-2016)
The Sound Generator can generate a sound based on volume, pitch and duration. This
sensor also can overwrite settings during a tone to change how it sounds, change the
volume, or to extend the duration of the tone. Refer to the Sound Generator example
folder for more information on different implementation methods.
Default I2C Address = 0x34
Arduino I2C Address = 0x1A
Sound Generator Functions:
CORE_SOUND(int address)
void setVolume(int level)
void setPitch(int frequency)
void setDuration(int length)
int getDuration(void)
void setSound(int level, int frequency, int length)
void setSoundBlocking(int level, int frequency, int
length, int post_pause)
void morseCode(const char character, int level, int frequency)
CORE_SOUND(int address)
Save the I2C address for future reads and writes.
This must be done before setup().
CORE_SOUND beep;
…or…
CORE_SOUND beep(0x1A);
void setVolume(int level)
There are four volume modes associated with this sensor; LOW, MEDIUM, HIGH
and MAX. The volume directly affects the amplitude of the wave being produced
by the sensor.
beep.setVolume(LOW);
beep.setVolume(MEDIUM);
beep.setVolume(HIGH);
beep.setVolume(MAX);