Code for autonomous rover for Sparkfun AVC. DataBus won 3rd in 2012 and the same code was used on Troubled Child, a 1986 Jeep Grand Wagoneer to win 1st in 2014.

Dependencies:   mbed Watchdog SDFileSystem DigoleSerialDisp

Revision:
0:a6a169de725f
Child:
23:a34af501ea89
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/Beep/Beep.cpp	Mon May 27 13:26:03 2013 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "Beep.h"
+
+/** Create a Beep object connected to the specified PwmOut pin
+ *
+ * @param pin PwmOut pin to connect to 
+ */
+Beep::Beep(PinName pin) : _pwm(pin) {
+    _pwm.write(0.0);     // after creating it have to be off
+}
+
+ /** Stop the beep instantaneously.
+  */
+void Beep::nobeep() {
+    _pwm.write(0.0);
+}
+
+/** Beep with given frequency and duration.
+ *
+ * @param frequency - the frequency of the tone in Hz
+ * @param time - the duration of the tone in seconds
+ */
+     
+void Beep::beep(float freq, float time) {
+
+    _pwm.period(1.0/freq);
+    _pwm.write(0.5);            // 50% duty cycle - beep on
+    toff.attach(this,&Beep::nobeep, time);   // time to off
+}
+
+
+
+