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

Class Beeper

source code

Abstraction of the beeper attached to given port (and ground).

Instance Methods [hide private]
 
__init__(self, pin=40) source code
 
turnOn(self)
Turns the beeper on.
source code
 
turnOff(self)
Turns the beeper off.
source code
 
beep(self, count=1)
Emits a short beep the given number of times.
source code
 
start(self, onTime, offTime, count=0, blocking=False)
Starts 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
 
setOnOffTime(self, onTime, offTime)
Sets the time the speaker is on and off.
source code
 
stop(self)
Stops beeping.
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 
Parameters:
  • port - the GPIO port number (default: 40)

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

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

setOnOffTime(self, onTime, offTime)

source code 

Sets the time the speaker is on and off.

Parameters:
  • onTime - the onTime in ms
  • offTime - the offTime in ms

isBeeping(self)

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