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
Fork of StateMachine_1 by
main.cpp
00001 00002 // Main zum Testen der IR Sensoren 00003 //V04.18 00004 // V. Ahlers 00005 00006 #include <mbed.h> 00007 #include "IRSensor.h" 00008 #include"StateMachine.h" 00009 00010 00011 AnalogIn IrRight(PC_3); 00012 AnalogIn IrLeft (PC_5); 00013 AnalogIn IrFront(PC_2); 00014 float disR = 0; 00015 float disL = 0; 00016 float disF = 0; 00017 00018 float dis2R = 0; 00019 float dis2L = 0; 00020 float dis2F = 0; 00021 int IrR = 0; 00022 int IrL = 0; 00023 int IrF = 0; 00024 int caseDrive = 0; 00025 00026 IRSensor iRSensor(IrRight, IrLeft, IrFront, dis2R, dis2L, dis2F); 00027 StateMachine stateMachine(IrR, IrL, IrF); 00028 00029 00030 00031 int main() { 00032 00033 00034 printf("\n die Distanzen sind\n"); 00035 while(1) { 00036 float disR = iRSensor.readR(); // Distanz in mm 00037 float disL = iRSensor.readL(); 00038 float disF = iRSensor.readF(); 00039 dis2R = disR; 00040 dis2L = disL; 00041 dis2F = disF; 00042 int IrR = iRSensor.codeR(); // min Distanz unterschritten = 1 00043 int IrL = iRSensor.codeL(); 00044 int IrF = iRSensor.codeF(); 00045 int caseDrive = stateMachine.drive(); //entscheidung welcher Drive Case 00046 00047 00048 printf ("IR Right = %f \n", disR); 00049 printf("IR Left = %f \n",disL); 00050 printf("IR Front = %f\n",disF); 00051 00052 wait (1.0); 00053 } 00054 }
Generated on Wed Jul 13 2022 13:00:51 by
1.7.2
