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.
Dependencies: FastPWM3 mbed-dev-STM-lean
Revision 76:4fd876d4cf2b, committed 2022-10-18
- Comitter:
- adimmit
- Date:
- Tue Oct 18 16:22:24 2022 +0000
- Parent:
- 75:c7fbacd92b8f
- Child:
- 77:81c2cbc5d906
- Commit message:
- added some position data logging;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Aug 29 18:57:14 2022 +0000
+++ b/main.cpp Tue Oct 18 16:22:24 2022 +0000
@@ -13,9 +13,11 @@
#define VERSION_NUM "2.0" //changed to 2.0 for flash storage version
+#define LOG_POINTS 500
float __float_reg[64]; // Floats stored in flash
int __int_reg[256]; // Ints stored in flash. Includes position sensor calibration lookup table
+float pos_high_frequency[LOG_POINTS];
#include "mbed.h"
#include "PositionSensor.h"
@@ -518,6 +520,14 @@
case 'd':
controller.i_q_ref = 0;
controller.i_d_ref = 0;
+ case 'p':
+ //turn off switching
+ state = REST_MODE;
+ state_change = 1;
+ //print the characters to terminal
+ for (int i=0; i< LOG_POINTS; i++) {
+ printf("%f\n\r", pos_high_frequency[i]); //return carrige
+ }
}
}
@@ -638,6 +648,13 @@
wait(.1);
if(controller.otw_flag){gpio.led->write(!gpio.led->read());}
+
+ if(state == MOTOR_MODE) {
+ for (int i=0; i<= LOG_POINTS-2; i++) {
+ pos_high_frequency[i] = pos_high_frequency[i+i];
+ }
+ pos_high_frequency[499] = controller.theta_mech;
+ }
/*
if(state == MOTOR_MODE)
{