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.
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 2:bbaa6fca2ab1
- Parent:
- 1:b862262a9d14
- Child:
- 3:e3d12393adb1
--- a/main.cpp Wed Sep 04 15:30:13 2019 +0000
+++ b/main.cpp Wed Oct 02 11:22:51 2019 +0000
@@ -1,23 +1,23 @@
#include "mbed.h"
-//#include "HIDScope.h"
-//#include "QEI.h"
#include "MODSERIAL.h"
-//#include "BiQuad.h"
-//#include "FastPWM.h"
+#include "FastPWM.h"
+#include "QEI.h"
-DigitalOut led(LED_RED);
-
-MODSERIAL pc(USBTX, USBRX);
+DigitalOut motor2_direction(D4);
+PwmOut motor2_pwm(D5);
-int main()
-{
- pc.baud(115200);
- pc.printf("\r\nStarting...\r\n\r\n");
-
+int main() {
while (true) {
-
- led = !led;
-
- wait_ms(500);
+ motor2_direction = 1;
+ for (float i = 0; i < 1; i+=0.01) {
+ motor2_pwm = i;
+ wait(0.1);
+ }
+ motor2_direction = 0;
+ for (float i = 0; i < 1; i+=0.01) {
+ motor2_pwm = i;
+ wait(0.1);
+ }
}
}
+
\ No newline at end of file