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.
main.cpp
- Committer:
- shalab
- Date:
- 2014-02-20
- Revision:
- 0:8a42934ad23a
- Child:
- 1:35b072614734
File content as of revision 0:8a42934ad23a:
#include "mbed.h"
#include "VNH5019MC.h"
DigitalOut led1(LED1);
Serial pc(USBTX, USBRX);
// Motor
VNH5019MC motor(p19, p20, p21, p22);
int main() {
pc.printf("\r\n\r\n\r\n");
pc.printf("Shalab - Tutorial03_SimpleMotorControl\r\n");
int duty = 0;
bool increment = true;
while(1) {
if ( duty >= 100 ) increment = false;
if ( duty <= -100) increment = true;
if (increment) duty++;
else duty--;
motor.move(duty);
led1 = !led1;
wait(0.2);
}
}