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: mbed QEI biquadFilter MODSERIAL FastPWM ttmath Math
Diff: Motor_tryout.cpp
- Revision:
- 7:e119b12e5e7f
- Parent:
- 4:bd21569250c7
- Child:
- 8:017b813c72bb
diff -r bd21569250c7 -r e119b12e5e7f Motor_tryout.cpp
--- a/Motor_tryout.cpp Mon Sep 30 11:36:51 2019 +0000
+++ b/Motor_tryout.cpp Mon Sep 30 12:26:33 2019 +0000
@@ -1,19 +1,22 @@
#include "mbed.h"
-#include "MODSERIAL.h"
+//#include "MODSERIAL.h"
-DigitalOut motor1_pwm(D3);
-MODSERIAL pc(USBTX, USBRX);
+// test
+
+DigitalOut motor1_pwm(PTA2);
+//MODSERIAL pc(USBTX, USBRX);
+
int main(void)
{
int frequency_pwm = 10000; //10 kHz PWM
- PwmOut motor1_pwm(D3);
- motor1_pwm.period(1.0/frequency_pwm); // T=1/f
+ PwmOut motor1_pwm(PTA2);
+ motor1_pwm.period(1.0/(double)frequency_pwm); // T=1/f
while(true)
{
- for(int pct = 0 ; pct <= 100 ; pct = pct +10)
+ for(int pct = 0 ; pct <= 100 ; pct += 10)
{
motor1_pwm.write(pct/100.0); // write Duty Cycle
- wait(0.1);
+ wait(1.0f);
}
}
}
\ No newline at end of file
