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: ContinuousServo Tach mbed
Revision 3:c1fe893d0353, committed 2018-04-26
- Comitter:
- PlayaLarrea
- Date:
- Thu Apr 26 19:44:42 2018 +0000
- Parent:
- 2:c97e01b25777
- Child:
- 4:7b311ca1ad32
- Commit message:
- 14 gay shit
Changed in this revision
| stop.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/stop.cpp Wed Apr 25 13:34:02 2018 +0000
+++ b/stop.cpp Thu Apr 26 19:44:42 2018 +0000
@@ -6,18 +6,24 @@
ContinuousServo right(p26);
AnalogIn sonar(p20);
Ticker ultra;
+Serial pc(USBTX,USBRX);
-float wall = 0.0;
-
+float wall;
+float analog;
+float range;
+
void update() {
- wall = ultra.read();
+ wall = 102.04*sonar.read();
+ pc.printf("%f\r\n", wall);
}
int main() {
ultra.attach(&update, .25);
- while(wall>10.0) { // main code for driving goes here
+ while(wall>12.0) { // main code for driving goes here
left.speed(.5);
right.speed(-.5);
}
+ left.stop();
+ right.stop();
}
\ No newline at end of file