Utilities classes for the Zumo Robot
Dependents: ZumoRobotBluetoothControlled Fsl_Zumo
This library represents some useful code for controlling your Zumo Robot.
Diff: Buzzer.cpp
- Revision:
- 5:5e12111ef01f
- Parent:
- 4:dcd52a961392
- Child:
- 6:7740c9d8d834
--- a/Buzzer.cpp Thu Nov 27 16:08:05 2014 +0000 +++ b/Buzzer.cpp Thu Dec 11 20:52:06 2014 +0000 @@ -10,7 +10,8 @@ Buzzer::Buzzer(PinName buzzerPinName):buzzerPin(buzzerPinName) { // Initialising - buzzerPin.write(0.0f); + buzzerPin.period_us(0); + buzzerPin.pulsewidth_us(0); } Buzzer::~Buzzer() { @@ -20,13 +21,14 @@ void Buzzer::stopBeep() { - buzzerPin.write(0.0f); + buzzerPin.period_us(0); + buzzerPin.pulsewidth_us(0); } void Buzzer::startBeep(float frequency, float duration) { buzzerPin.period(1/frequency); - buzzerPin.write(0.75f); + buzzerPin.pulsewidth_us(100); timeout.attach(this, &Buzzer::stopBeep, duration); }