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 0:d111bbbfd9e2, committed 2019-05-02
- Comitter:
- kevinganhito
- Date:
- Thu May 02 10:31:56 2019 +0000
- Commit message:
- Fan Controller;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PwmIn.lib Thu May 02 10:31:56 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/PwmIn/#6d68eb9b6bbb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu May 02 10:31:56 2019 +0000
@@ -0,0 +1,31 @@
+// STM32L432KC
+// https://os.mbed.com/platforms/ST-Nucleo-L432KC/
+
+
+#include "mbed.h"
+#include "PwmIn.h"
+
+#define PWM_FAN_1 D9
+#define TACHO_FAN_1 D11
+
+#define PWM_FREQUENCY 25000
+#define DUTY_CYCLE 50
+
+PwmOut mypwm1(PWM_FAN_1);
+
+PwmIn tacho1(TACHO_FAN_1);
+
+int main() {
+
+ //PWM period
+
+ mypwm1.period_us((int) (PWM_FREQUENCY/25));
+ mypwm1.pulsewidth_us((int)(PWM_FREQUENCY*DUTY_CYCLE/100)); // Not lower than 10 us
+
+ printf("PWM Duty is set to %.2f %%\n", mypwm1.read() * 100);
+ float speed1;
+ while(1) {
+ speed1 = tacho1.period() * 1000;
+ printf("Speed: %f\n",speed1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 02 10:31:56 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file