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
Dependents: DumpTruck turn_pot
Revision 2:33be70fd7c4b, committed 2016-09-26
- Comitter:
- simplyellow
- Date:
- Mon Sep 26 21:59:45 2016 +0000
- Parent:
- 0:a8839a6b9e39
- Commit message:
- new notes on turning
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Sep 20 19:35:30 2016 +0000
+++ b/main.cpp Mon Sep 26 21:59:45 2016 +0000
@@ -1,13 +1,31 @@
#include "mbed.h"
#include "Motor.h"
+Motor turn(p23, p28);
+AnalogIn pot(p15);
Serial pc(USBTX, USBRX);
-Motor m1(p24,p30);
-//Motor m2(p23,p28);
-//Motor m3(p23,p28);
-//Motor m4(p23,p28);
+int main() {
+ pc.printf("%f", pot);
+
+ turn.write(0.3f); //drive forward for 2 seconds
+ wait(2);
+ turn.write(-0.3f); //drive backward for 2 seconds
+ wait(2);
+ turn.write(0); //stop for 2 secs
+ wait(2); //
+
+}
-int main() {
- m1.write(1.0f);
-}
\ No newline at end of file
+
+//NOTES ON TURNING
+/*
+at start up, store the starting pot value
+for each direction +/- 0.15 float- those are the approximate limits of the turn
+when turning we have to consider two values:
+ velocity (speed and directional bit)
+ duration (the wait delay)
+ we need to find the experimental relationship between these two
+
+Limit switch just 0 and 1, nothing special
+*/