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
stop.cpp
- Committer:
 - PlayaLarrea
 - Date:
 - 2018-04-25
 - Revision:
 - 2:c97e01b25777
 - Parent:
 - main.cpp@ 1:eaa66fbc27f2
 - Child:
 - 3:c1fe893d0353
 
File content as of revision 2:c97e01b25777:
#include "mbed.h"
#include "ContinuousServo.h"
#include "Tach.h"
ContinuousServo left(p23);
ContinuousServo right(p26);
AnalogIn sonar(p20);
Ticker ultra;
float wall = 0.0;
 
void update() {
    wall = ultra.read();
}
 
int main() {
    ultra.attach(&update, .25);
    
    while(wall>10.0) { // main code for driving goes here
    left.speed(.5);
    right.speed(-.5);
    }
}