Module LegoRobot :: Class LegoRobot
[frames] | no frames]

Class LegoRobot

source code

Instance Methods
 
__init__(self) source code
 
exit(self) source code
 
getBrickPi(self)
Returns the instance of the BrickPi class.
source code
 
addParts(self) source code
 
isEscapeHit(self)
Checks, if the left button was ever hit or hit since the last invocation.
source code
Static Methods
 
playTone(frequency, duration)
Plays a single sine tone with given frequency and duration.
source code
 
getIPAddresses()
Returns: List of all IP addresses of machine
source code
 
initSound(soundFile, volume)
Prepares the given wav or mp3 sound file for playing with given volume (0..100).
source code
 
closeSound()
Stops any playing sound and closes the sound channel.
source code
 
playSound()
Starts playing.
source code
 
fadeoutSound(time)
Decreases the volume slowly and stops playing.
source code
 
setSoundVolume(volume)
Sets the volume while the sound is playing.
source code
 
stopSound()
Stops playing sound.
source code
 
pauseSound()
Temporarily stops playing at current position.
source code
 
resumeSound()
Resumes playing from stop position.
source code
 
rewindSound()
Resumes playing from the beginning.
source code
 
isSoundPlaying()
Returns: True, if the sound is playing; otherwise False
source code
Method Details

getBrickPi(self)

source code 

Returns the instance of the BrickPi class. Any of its methods may be called.

isEscapeHit(self)

source code 

Checks, if the left button was ever hit or hit since the last invocation.

Returns:
True, if the button was hit; otherwise False

playTone(frequency, duration)
Static Method

source code 

Plays a single sine tone with given frequency and duration.

Parameters:
  • frequency - the frequency in Hz
  • duration - the duration in ms

getIPAddresses()
Static Method

source code 
Returns:
List of all IP addresses of machine

initSound(soundFile, volume)
Static Method

source code 

Prepares the given wav or mp3 sound file for playing with given volume (0..100). The sound sound channel is opened and a background noise is emitted.

Parameters:
  • soundFile - the sound file in the local file system
Returns:
True, if successful; False if the sound system is not available or the sound file cannot be loaded

fadeoutSound(time)
Static Method

source code 

Decreases the volume slowly and stops playing.

Parameters:
  • time - the fade out time in ms

setSoundVolume(volume)
Static Method

source code 

Sets the volume while the sound is playing.

Parameters:
  • volume - the sound volume (0..100)

isSoundPlaying()
Static Method

source code 
Returns:
True, if the sound is playing; otherwise False