test2

Dependencies:   MODDMA mbed sofi7

Files at this revision

API Documentation at this revision

Comitter:
arizonat
Date:
Sun Dec 05 18:19:53 2021 +0000
Parent:
2:7ca59d64e460
Commit message:
Added period to define statements for easy change and some bug hack fixes also moved hall effect to different pin from pumpvalve

Changed in this revision

robotic_fish_6/FishController.cpp Show annotated file Show diff for this revision Revisions of this file
robotic_fish_6/FishController.h Show annotated file Show diff for this revision Revisions of this file
robotic_fish_6/PumpWithValve/PumpWithValve.h Show annotated file Show diff for this revision Revisions of this file
--- a/robotic_fish_6/FishController.cpp	Sun Dec 05 14:53:30 2021 +0000
+++ b/robotic_fish_6/FishController.cpp	Sun Dec 05 18:19:53 2021 +0000
@@ -103,7 +103,7 @@
     thrustCommand = 0;
     dutyCycle = 0;
     brushlessOff = false;
-    motorPWM.period(0.0005); //default is 0.02sec, or 50Hz. 0.0005 is 2kHz, max is 0.00005 or 20kHz for the VNH5019
+    //motorPWM.period(0.0005); //default is 0.02sec, or 50Hz. 0.0005 is 2kHz, max is 0.00005 or 20kHz for the VNH5019
 #endif
 
 //    buttonBoard.registerCallback(&FishController::buttonCallback);
@@ -304,6 +304,9 @@
     if(dutyCycle < 0 && dutyCycle > -0.01)
         dutyCycle = 0;
     // Update the brushed motor
+    
+    motorPWM.period(fishPWMPeriod);
+    
     if(dutyCycle >= 0)
     {
         motorOutA.write(0);
--- a/robotic_fish_6/FishController.h	Sun Dec 05 14:53:30 2021 +0000
+++ b/robotic_fish_6/FishController.h	Sun Dec 05 18:19:53 2021 +0000
@@ -61,6 +61,7 @@
 #define fishMinThrust    ((float)(0.0))
 #ifdef FISH4
 #define fishMaxThrust    ((float)(0.7))
+#define fishPWMPeriod    ((float)(0.0001)) //default is 0.02sec, or 50Hz. 0.0005 is 2kHz, max is 0.00005 or 20kHz for the VNH5019
 #endif
 #ifdef FISH6
 #define fishMaxThrust    ((float)(1.0))
--- a/robotic_fish_6/PumpWithValve/PumpWithValve.h	Sun Dec 05 14:53:30 2021 +0000
+++ b/robotic_fish_6/PumpWithValve/PumpWithValve.h	Sun Dec 05 18:19:53 2021 +0000
@@ -12,7 +12,7 @@
 
 #define valvePwmPin 		p22
 #define pumpPwmPin 			p23
-#define hallInterruptPin 	p12
+#define hallInterruptPin 	p15
 //#define encoderPinA 		p25
 //#define encoderPinB 		p24
 //#define valveCurrentPin 	p19