added buzzer function

Fork of m3pi by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
richardfirth
Date:
Mon Jan 18 05:35:59 2016 +0000
Parent:
9:3053f0dbd8d6
Commit message:
with buzzer

Changed in this revision

m3pi.cpp Show annotated file Show diff for this revision Revisions of this file
m3pi.h Show annotated file Show diff for this revision Revisions of this file
--- a/m3pi.cpp	Sun Jan 17 05:17:48 2016 +0000
+++ b/m3pi.cpp	Mon Jan 18 05:35:59 2016 +0000
@@ -77,6 +77,28 @@
     motor(1,0.0);
 }
 
+
+
+// Richard Added
+
+int m3pi::playBuzzer (char* tune) {
+    _ser.putc(DO_PLAY);  
+    _ser.putc(strlen(tune));       
+    for (int i = 0 ; i < strlen(tune) ; i++) {
+        _ser.putc(tune[i]); 
+    }
+    return(0);
+}
+
+
+// Richard Added
+
+
+
+
+
+
+
 void m3pi::motor (int motor, float speed) {
     char opcode = 0x0;
     if (speed > 0.0) {
--- a/m3pi.h	Sun Jan 17 05:17:48 2016 +0000
+++ b/m3pi.h	Mon Jan 18 05:35:59 2016 +0000
@@ -149,6 +149,15 @@
      * @returns voltage as a float
      *
      */
+     
+     
+     // Richard Added
+
+     int playBuzzer(char* tune);
+     
+     // Richard Added
+     
+     
     float pot_voltage(void);
 
     /** Read the battery voltage on the 3pi