Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 5:72bdc69d610d, committed 2018-06-29
- Comitter:
- viaromassimo
- Date:
- Fri Jun 29 14:05:20 2018 +0000
- Parent:
- 4:1643fea75703
- Child:
- 6:3263fc9d7423
- Commit message:
- #define
Changed in this revision
--- a/io_definitions.h Fri Jun 29 13:07:46 2018 +0000 +++ b/io_definitions.h Fri Jun 29 14:05:20 2018 +0000 @@ -1,5 +1,7 @@ //#Serial pc(SERIAL_TX, SERIAL_RX); -Serial pc(D1, D0, 115200); +#if defined(logActive) + Serial pc(D1, D0, 115200); +#endif InterruptIn WheelSensorPin(D5); //pin at which the wheel sensor is attached InterruptIn MotorSensorPin(D4); //pin connected to motor sensor pin
--- a/main.cpp Fri Jun 29 13:07:46 2018 +0000
+++ b/main.cpp Fri Jun 29 14:05:20 2018 +0000
@@ -146,16 +146,6 @@
//***************************************************
void writelog(){
- pc.printf("\nMotorSpeedCorrected %f",MotorSpeedCorrected);
- pc.printf(" - WantedMotorSpeed %d",WantedMotorSpeed);
- pc.printf(" - ReadMotorSpeed %d",ReadMotorSpeed);
- pc.printf(" - ElapsedW %d",ElapsedW);
- pc.printf(" - TempReadW %d",TempReadW);
- pc.printf(" - ElapsedM %d",ElapsedM);
- pc.printf(" - TempReadM %d",TempReadM);
- pc.printf(" - Plus %d",PercentPlus);
- pc.printf(" - Minus %d",PercentMinus);
- pc.printf(" - Security %d",SecurityStop);
}
//***************************************************
@@ -188,9 +178,18 @@
MotorPwmPin.write(MotorSpeedCorrected);
DC_brake=0;
DC_prepare();
-
- writelog();
-
+#if defined(logActive)
+ pc.printf("\nMotorSpeedCorrected %f",MotorSpeedCorrected);
+ pc.printf(" - WantedMotorSpeed %d",WantedMotorSpeed);
+ pc.printf(" - ReadMotorSpeed %d",ReadMotorSpeed);
+ pc.printf(" - ElapsedW %d",ElapsedW);
+ pc.printf(" - TempReadW %d",TempReadW);
+ pc.printf(" - ElapsedM %d",ElapsedM);
+ pc.printf(" - TempReadM %d",TempReadM);
+ pc.printf(" - Plus %d",PercentPlus);
+ pc.printf(" - Minus %d",PercentMinus);
+ pc.printf(" - Security %d",SecurityStop);
+#endif
}else{
OffTheMotor();
}
@@ -282,8 +281,9 @@
MSToMotorNewCheck.attach(&CheckMotorCorrection, 0.1); //check motor correction every xx seconds
ReadWheelArray.clear();
ReadMotorArray.clear();
- pc.printf("\n\n Hello World\n\n");
-
+#if defined(logActive)
+ pc.printf("\n\n Salute, Capo!\n\n");
+#endif
WheelSensorPin.rise(&ReadWheelInterrupt); //interrupt for wheel sensor, trigs when changes from 0 to 1
MotorSensorPin.rise(&ReadMotorInterrupt); //interrupt for motor sensor, trigs when changes from 0 to 1
--- a/main.h Fri Jun 29 13:07:46 2018 +0000 +++ b/main.h Fri Jun 29 14:05:20 2018 +0000 @@ -1,10 +1,10 @@ +#define logActive +//#define canbusActive + #include "mbed.h" +#include "io_definitions.h" #include "CB1.h" #include "string" #include "PID.h" -#include "io_definitions.h" #include "timeandtick.h" -#include "variables.h" - -//#define canbusActive - +#include "variables.h" \ No newline at end of file