A program to monitor some parameters for a motor
Dependencies: mbed-dev BufferSerial
Thanks to David Lowe for https://developer.mbed.org/users/gregeric/code/Nucleo_Hello_Encoder/ which I adapted for the use of TIM2 32bit timer as an encoder reader on the Nucleo L432KC board.
Diff: main.cpp
- Revision:
- 21:65f16b24ccd8
- Parent:
- 20:f62feecc8334
- Child:
- 22:9bba1417e4a4
--- a/main.cpp Sun Jun 18 21:20:00 2017 +0000 +++ b/main.cpp Wed Jun 21 01:27:13 2017 +0000 @@ -233,8 +233,8 @@ printf("M:ADC false\n"); } else if (p1=strstr(message, "dac=") != NULL) { //Writing the dac1 value read from serial - //The DCPS has 1V offset, so we have to remove it - dac_val = (atof(message+p1+3)-1.0f)/15.51; + //The DCPS has 1.2V offset, so we have to remove it + dac_val = (atof(message+p1+3)-1.2f)/15.9; dac1.write(dac_val); } else if (strcmp(message, "reset") == 0) { //encoder related counters reset command