pt.citar.diablu.nxt.protocol
Class NXTCommandPlayTone

java.lang.Object
  extended by pt.citar.diablu.nxt.protocol.NXTCommand
      extended by pt.citar.diablu.nxt.protocol.NXTCommandPlayTone

public class NXTCommandPlayTone
extends NXTCommand

Represents the PLAYTONE Command. The response to this command (if required) is a NXTResponseStatus.
Example 1:


 
Example 2:

 

Author:
Jorge Cardoso
See Also:
NXTResponseStatus

Constructor Summary
NXTCommandPlayTone()
           
NXTCommandPlayTone(int frequency, int duration)
          Constructs a new NXTCommandPlayTone object with a given frequency and duration and with no response requirement.
NXTCommandPlayTone(int frequency, int duration, boolean responseRequired)
          Constructs a new NXTCommandPlayTone object with a given frequency, duration and response requirement.
 
Method Summary
 int getDuration()
          Returns the current duration set to be played when the command is sent.
 int getFrequency()
          Returns the current frequency set to be played when the command is sent.
 void setDuration(int duration)
          Sets the duration of the tone to play.
 void setFrequency(int frequency)
          Sets the frequency of the tone to play.
 
Methods inherited from class pt.citar.diablu.nxt.protocol.NXTCommand
getPacketLength, isResponseRequired, sendCommand, setResponseRequired, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NXTCommandPlayTone

public NXTCommandPlayTone()

NXTCommandPlayTone

public NXTCommandPlayTone(int frequency,
                          int duration)
Constructs a new NXTCommandPlayTone object with a given frequency and duration and with no response requirement.

Parameters:
frequency - The frequency of the tone. Only the two least significant bytes are considered.
duration - The duration of the tone. Only the two least significatn bytes are considered.

NXTCommandPlayTone

public NXTCommandPlayTone(int frequency,
                          int duration,
                          boolean responseRequired)
Constructs a new NXTCommandPlayTone object with a given frequency, duration and response requirement.

Parameters:
frequency - The frequency of the tone. Only the two least significant bytes are considered.
duration - The duration of the tone. Only the two least significatn bytes are considered.
responseRequired - Indicates if a response to this command is required.
Method Detail

getFrequency

public int getFrequency()
Returns the current frequency set to be played when the command is sent.

Returns:
The frequency of the tone.

setFrequency

public void setFrequency(int frequency)
Sets the frequency of the tone to play.

Parameters:
frequency - The frequency to play. On the two least significant bytes are considered.

getDuration

public int getDuration()
Returns the current duration set to be played when the command is sent.

Returns:
The duration of the tone.

setDuration

public void setDuration(int duration)
Sets the duration of the tone to play.

Parameters:
duration - The frequency to play. On the two least significant bytes are considered.


Processing library NXTComm by Jorge C. S. Cardoso. (c) 2014