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:
- 2017-11-16
- Revision:
- 0:3f81076404ad
- Child:
- 1:55c209e14e75
File content as of revision 0:3f81076404ad:
#include "mbed.h"
DigitalOut M3_DIR (D4);
DigitalIn button1(SW3);
DigitalIn button2(SW2);
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(button1)
{
M3.write(0.0f);
}
else
{
M3.write(0.03f);
M3_DIR.write(1);
}
if(button2)
{
M3.write(0.0f);
}
else
{
M3.write(0.03f);
M3_DIR.write(0);
}
}
return 0;
}