Hard brake rather than coast

Fork of PololuQik2 by Paolina Povolotskaya

Files at this revision

API Documentation at this revision

Comitter:
jjcarr2
Date:
Tue Apr 01 20:22:30 2014 +0000
Parent:
1:df9964aaa00d
Commit message:
stopBothMotors = hard Brake;

Changed in this revision

PololuQik2.cpp Show annotated file Show diff for this revision Revisions of this file
PololuQik2.h Show annotated file Show diff for this revision Revisions of this file
diff -r df9964aaa00d -r 25c41766d768 PololuQik2.cpp
--- a/PololuQik2.cpp	Fri Mar 21 22:19:23 2014 +0000
+++ b/PololuQik2.cpp	Tue Apr 01 20:22:30 2014 +0000
@@ -79,9 +79,11 @@
     }
 }
 
-void PololuQik2::stopBothMotors() {
-    setMotor0Speed(1);
-    setMotor1Speed(1);
+void PololuQik2::stopBothMotors(int8_t speed) {
+    unsigned char message[] = {MOTOR0COASTPACKET, speed};
+    sendMessage(message , 2);
+    unsigned char message2[] = {MOTOR1COASTPACKET, speed};
+    sendMessage(message2 , 2);
 }
 
 void PololuQik2::sendMessage(unsigned char message[], uint8_t length) {
diff -r df9964aaa00d -r 25c41766d768 PololuQik2.h
--- a/PololuQik2.h	Fri Mar 21 22:19:23 2014 +0000
+++ b/PololuQik2.h	Tue Apr 01 20:22:30 2014 +0000
@@ -123,7 +123,7 @@
      * This is equivalent to called any of the forward or reverse methods
      * with the speed as zero (0).
      */
-    void stopBothMotors();
+    void stopBothMotors(int8_t speed);
 
     /**
      * retrieves the firmware version from the motor controller. This will return one of two values.