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.
Revision 2:0b86e6482e4b, committed 2016-10-11
- Comitter:
- csellier
- Date:
- Tue Oct 11 11:47:25 2016 +0000
- Parent:
- 1:8c1e3382b4d7
- Child:
- 3:581d391d248c
- Commit message:
- Updated with the input and output pin of the IR sensors, LDRs and LEDs
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 07 15:09:20 2016 +0000 +++ b/main.cpp Tue Oct 11 11:47:25 2016 +0000 @@ -1,8 +1,15 @@ #include "mbed.h" #include "Servo.h" -Serial pc(USBTX, USBRX); // USB serial interface +Serial pc (USBTX, USBRX); // USB serial interface Servo ServoRight(p21); // continuous rotation hobby servo right Servo ServoLeft(p22); // continuous rotation hobby servo left +PwmOut LEDleft(p23); +PwmOut LEDright(p24); +AnalogIn IRfront(p15); +AnalogIn IRleft(p16); +AnalogIn IRright(p17); +AnalogIn LDRleft(p18); +AnalogIn LDRright(p19); void init_servo() { // calibrate the servos for +/-5ms over +/-45deg @@ -19,7 +26,10 @@ while(1) { - + //Turn both LED's on for the line following feature + LEDleft=1; + LEDright=1; + // sernd the servo command to the servos themselves ServoRight.write(0.6); // write to the continuous rotation servo1 ServoLeft.write(0.4); // write to the continous servo2