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:8a42934ad23a
- Child:
- 1:35b072614734
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Feb 20 04:56:44 2014 +0000
@@ -0,0 +1,27 @@
+#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);
+ }
+}
\ No newline at end of file