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.
Fork of Project by
Diff: main.cpp
- Revision:
- 24:f4f933d9194b
- Parent:
- 23:806c9b8af77c
--- a/main.cpp Sat Apr 13 19:19:20 2013 +0000 +++ b/main.cpp Sat Apr 13 21:42:56 2013 +0000 @@ -757,79 +757,20 @@ userSetR = TSpeedR - uW; } - // data recording code - if (action == 2) + if (action == 2) + { + if (RecCount < 200) { - if (RecCount < 200) - { - RecX[RecCount] = eW; - RecU[RecCount] = uW; - RecV[RecCount] = DF; - RecE[RecCount] = DR; - RecCount++; - // - } + RecX[RecCount] = eW; + RecU[RecCount] = uW; + RecV[RecCount] = DF; + RecE[RecCount] = DR; + RecCount++; } - - + } } -/* -void IRChecker() -{ - float IRF, IRR; - float aF = 22.6321; // 34.2911 - float bF = -0.1721; // -0.2608 - float aR = 22.6021; // 34.2456 - float bR = -0.0376; // -0.0569 - // float Nominal = 25; - - // Read Sensors - IRF = 3.3*IRFront.read(); - IRR = 3.3*IRRear.read(); - - - // Calculate distance based on voltage - DF = aF/(IRF+bF); - DR = aR/(IRR+bR); - - // Display Distances - // BtS.printf("IRD F: %f R: %f\n\r\n", DF, DR); - - // Compare to nominal voltage and adjust - while(1) - { - if (DF > Nominal && DR > Nominal) - { - userSetR = TSpeedR + Turn; - userSetL = TSpeedL - Turn; - break; - } - if (DF < Nominal && DR < Nominal) - { - userSetR = TSpeedR - Turn; - userSetL = TSpeedL + Turn; - break; - } - - // Compare rangers to each other - if (DF > DR) // IRF further than IRR - { - userSetR = TSpeedR + Turn; - userSetL = TSpeedL - Turn; - break; - } - if (DF < DR) // IRF closer than IRR - { - userSetR = TSpeedR - Turn; - userSetL = TSpeedL + Turn; - break; - } - } -} -*/ - void DisplayMenu() { BtS.printf("\r\n\nPress the corresponding key to do something:\r\n");