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
Motor_tryout.cpp
- Committer:
- NinaGesthuizen
- Date:
- 2019-09-30
- Revision:
- 6:4dbd0d12e0f7
- Parent:
- 5:fea5544804c1
- Child:
- 11:7c2d492466c2
File content as of revision 6:4dbd0d12e0f7:
#include "mbed.h"
#include "MODSERIAL.h"
DigitalOut motor1_pwm(D3);
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
while(true)
{
for(int pct = 0 ; pct <= 100 ; pct = pct +10)
{
motor1_pwm.write(pct/100.0); // write Duty Cycle
wait(0.1);
}
}
}
// Comment kkd
