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:
- cjedwardz
- Date:
- 2018-02-12
- Revision:
- 0:9c87d309ecac
File content as of revision 0:9c87d309ecac:
#include "mbed.h"
#include "stdio.h"
PwmOut speed(p26);
DigitalOut fwd(p30);
// p26 connects to IN1 and determines motor speed
// p30 connects to IN2 and determines motor direction
// fwd = 1 gives CW motion, fwd = 0 gives CCW motion
int run = 1;
int main()
{
speed.period(0.008);
while(run == 1)
{
speed = 0.5;
fwd = 1;
wait(5.0);
speed = 0;
fwd = 0;
wait(5.0);
speed = .5;
fwd = 0;
wait(5.0);
speed = 0;
fwd = 0;
wait(5.0);
run = 0;
}
}