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 1:532b7273ebc6, committed 2016-10-24
- Comitter:
- simplyellow
- Date:
- Mon Oct 24 21:18:32 2016 +0000
- Parent:
- 0:d97c87993116
- Commit message:
- more measurements and calculations;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Oct 24 21:07:10 2016 +0000
+++ b/main.cpp Mon Oct 24 21:18:32 2016 +0000
@@ -7,25 +7,31 @@
float value;
float angle;
+float zero;
/*
the angular range of the pot is 66.8 degrees
+so +/- 33.4 degrees
the average float range is 0.2226
-so +/- 33.4 degrees
+so +/- 0.1113
+
+potentiometer source link
+http://www.alphapotentiometers.net/html/16mm_pot_6.html
*/
-int main() {
- while(1){
- value = (float) pot;
- angle = value
- pc.printf("%f\n\r", angle);
-
- wait(0.2);
- }
-}
/* DumpTruck pot measurements
0.274 to 0.498 -> 0.224
0.272 to 0.495 -> 0.223
0.277 to 0.498 -> 0.221
*/
+
+int main() {
+ zero = (float) pot; // this will be the center, 0 degrees
+ while(1){
+ value = (float) pot; // assuming turning wheels are in back
+ angle = (value - zero)*300; // negative = left turn
+ pc.printf("%f\n\r", angle); // positive = right turn
+ wait(0.2);
+ }
+}
\ No newline at end of file