|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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 IToneGenerator
hz
- the frequency to set the tone topublic double getFrequency()
getFrequency
in interface IToneGenerator
public void setPeriod(int p)
p
- value to set the period topublic void setDuration(int ms)
setDuration
in interface IToneGenerator
ms
- duration in millisecondspublic void startTone()
startTone
in interface IToneGenerator
public void endTone()
endTone
in interface IToneGenerator
public void beep()
beep
in interface IToneGenerator
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |