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.
Diff: main.cpp
- Revision:
- 0:3f81076404ad
- Child:
- 1:55c209e14e75
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Nov 16 10:18:43 2017 +0000
@@ -0,0 +1,42 @@
+#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;
+
+}
+