|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.sensorboard.peripheral.ToneGenerator
public class ToneGenerator
Allows attaching a simple speaker device to an output pin to generate various simple frequencies. Note: the tone will stop during deep sleep and resume when deep sleep is over. The core of the work is done by the microcontroller on the sensorboard.
| Field Summary | |
|---|---|
static int |
PERIOD_CONSTANT
Constant used to calculate the period of the tone given the desired frequency. |
| Constructor Summary | |
|---|---|
ToneGenerator(IOutputPin pin)
Creates a new instance of ToneGenerator. |
|
| Method Summary | |
|---|---|
void |
beep()
initiate a tone that will be asynchrounously stopped |
void |
endTone()
Ask the ToneGenerator to stop generating the tone. |
double |
getFrequency()
Returns the current value of the ToneGenerators frequency in Hertz |
void |
setDuration(int ms)
Sets the duration of the asynchronous beep. |
void |
setFrequency(double hz)
Sets the frequency that this tone generator is operating at. |
void |
setPeriod(int p)
Set the period of the tone generated. |
void |
startTone()
Ask the tonegenerator to begin generating the tone. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PERIOD_CONSTANT
| Constructor Detail |
|---|
public ToneGenerator(IOutputPin pin)
pin - where is the output device attached to the spot.| Method Detail |
|---|
public void setFrequency(double hz)
setFrequency in interface IToneGeneratorhz - the frequency to set the tone topublic double getFrequency()
getFrequency in interface IToneGeneratorpublic void setPeriod(int p)
p - value to set the period topublic void setDuration(int ms)
setDuration in interface IToneGeneratorms - duration in millisecondspublic void startTone()
startTone in interface IToneGeneratorpublic void endTone()
endTone in interface IToneGeneratorpublic void beep()
beep in interface IToneGenerator
|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||