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:
- nehalmathur
- Date:
- 2018-03-07
- Revision:
- 1:55c209e14e75
- Parent:
- 0:3f81076404ad
- Child:
- 2:b261cb3cafcf
File content as of revision 1:55c209e14e75:
#include "mbed.h"
DigitalOut M3_DIR (D4);
DigitalIn button1(SW3);
DigitalIn button2(SW2);
DigitalIn ButtonClockwise(D2);
DigitalIn ButtonAnticlockwise(D3);
PwmOut M3 (D5);
DigitalOut led_red_base(LED_RED);
float frequency_pwm = 10000.0f;
int main()
{
M3.period(1.0f/frequency_pwm);
while(true) {
if(ButtonClockwise)
{
M3.write(0.0f);
}
else
{
M3.write(0.03f);
M3_DIR.write(1);
}
if(ButtonAnticlockwise)
{
M3.write(0.0f);
}
else
{
M3.write(0.03f);
M3_DIR.write(0);
}
}
return 0;
}