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
main.cpp
00001 #define PI 3.141 00002 00003 #include "math.h" 00004 #include "mbed.h" 00005 #include "Encoder.h" 00006 #include "lineSensor.h" 00007 #include "PID2.h" 00008 #include "PID.h" 00009 #include "Wheel.h" 00010 #include "Robot.h" 00011 00012 00013 //blue D8 00014 //Green D9 00015 //Red D5 00016 int main() { 00017 Serial hm10(PA_11, PA_12); 00018 hm10.baud(9600); 00019 char prevC; 00020 00021 DigitalIn mybutton(USER_BUTTON); 00022 00023 DigitalOut enable(PA_13); 00024 enable.write(1); 00025 00026 Encoder* RE = new Encoder(PB_3,PB_5); 00027 Encoder* LE = new Encoder(PB_10,PB_4); 00028 Wheel* leftWheel = new Wheel(LE,PC_8,PA_9, PA_14); 00029 Wheel* rightWheel = new Wheel(RE,PC_6,PA_8, PA_7); 00030 00031 //an array of lineSensor pointers params: lineSensor(PinName emitter Pin, PinName reciever Pin, make sure it is from LEFT TO RIGHT 00032 lineSensor* sensorArray[6] = {new lineSensor(PB_9,A5),new lineSensor(PC_11,A4),new lineSensor(PD_2,A3),new lineSensor(PC_10,A2),new lineSensor(PB_8,A1),new lineSensor(PC_12,A0)}; 00033 00034 Robot rbt(leftWheel, rightWheel, sensorArray); 00035 00036 leftWheel->init2(); 00037 00038 rightWheel->init2(); 00039 00040 rbt.rbtInit(); 00041 prevC = 'C'; 00042 00043 while(1) 00044 { 00045 if(hm10.readable()) 00046 { 00047 rbt.setState(hm10.getc()); 00048 } 00049 } 00050 } 00051 00052 /* 00053 00054 */
Generated on Mon Nov 11 2024 23:43:29 by
1.7.2