Module Beeper :: Class Beeper
[hide private]
[frames] | no frames]

Class Beeper

source code

Class that represents a beeper.

Instance Methods [hide private]
 
__init__(self, pin=40)
Creates a beeper instance attached to the given GPIO port.
source code
 
turnOn(self)
Turns the beeper on.
source code
 
turnOff(self)
Turns the beeper off.
source code
 
start(self, onTime, offTime, count=0, blocking=False)
Starts beeping.
source code
 
stop(self)
Stops beeping.
source code
 
setOffTime(self, offTime)
Sets the time the speaker is off.
source code
 
setOnTime(self, onTime)
Sets the time the speaker is on.
source code
 
beep(self, count=1)
Emits a short beep the given number of times.
source code
 
isBeeping(self)
Returns: True, if the beeper is active; otherwise False
source code
 
_checkRobot(self) source code
Method Details [hide private]

__init__(self, pin=40)
(Constructor)

source code 

Creates a beeper instance attached to the given GPIO port.

Parameters:
  • pin - the GPIO port number (default: 40)

start(self, onTime, offTime, count=0, blocking=False)

source code 

Starts beeping. The beeping period is offTime + onTime. May be stopped by calling stop(). If blocking is False, the function returns immediately while the blinking goes on. The blinking is stopped by setColor().

Parameters:
  • onTime - the time in ms in on state
  • offTime - the time in ms in off state
  • count - total number of on states; 0 for endlessly (default)
  • blocking - if True, the method blocks until the beeper has finished; otherwise it returns immediately (default: False)

setOffTime(self, offTime)

source code 

Sets the time the speaker is off.

Parameters:
  • offTime - the offTime in ms

setOnTime(self, onTime)

source code 

Sets the time the speaker is on.

Parameters:
  • onTime - the onTime in ms

beep(self, count=1)

source code 

Emits a short beep the given number of times. Blocking until the beeps are played.

Parameters:
  • count - the number of beeps

isBeeping(self)

source code 
Returns:
True, if the beeper is active; otherwise False