Soma Takahashi / ikarashiMDC

Files at this revision

API Documentation at this revision

Comitter:
WAT34
Date:
Wed Aug 30 06:55:32 2017 +0000
Parent:
3:615ccca78f67
Child:
8:626daa6d81ac
Commit message:
braking added;

Changed in this revision

ikarashiMDC.cpp Show annotated file Show diff for this revision Revisions of this file
ikarashiMDC.h Show annotated file Show diff for this revision Revisions of this file
--- a/ikarashiMDC.cpp	Tue Aug 22 01:55:17 2017 +0000
+++ b/ikarashiMDC.cpp	Wed Aug 30 06:55:32 2017 +0000
@@ -9,6 +9,7 @@
     addr = taddr;
     motorNum = tmotorNum;
     mode = tmode;
+    braking = false;
 }
 
 int ikarashiMDC::setSpeed(const double& speed)
@@ -25,7 +26,7 @@
     //printf("%d\n",dataSpeed);
     //set sending data
     data[0] = 255; //header
-    data[1] = (addr<<5) + motorNum + (mode<<4); //address
+    data[1] = (addr<<5) + motorNum + (mode<<4)+(braking<<3); //address
     data[2] = dataSpeed;
     //send data
     for(int i=0; i<4; i++) {
--- a/ikarashiMDC.h	Tue Aug 22 01:55:17 2017 +0000
+++ b/ikarashiMDC.h	Wed Aug 30 06:55:32 2017 +0000
@@ -59,6 +59,7 @@
     * @param speed of motor -1 to 1
     **/
     int setSpeed(const double& speed);
+    bool braking;
 
 protected:   
     uint8_t addr;