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 0:478ae94859c2, committed 2012-11-08
- Comitter:
- tylerjw
- Date:
- Thu Nov 08 21:43:41 2012 +0000
- Commit message:
- config.txt (r:%f,l:%f)
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Thu Nov 08 21:43:41 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tylerjw/code/Servo/#1e75dcbded83
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Nov 08 21:43:41 2012 +0000
@@ -0,0 +1,54 @@
+#include "mbed.h"
+#include "Servo.h"
+
+LocalFileSystem local("local"); // Create the local filesystem under the name "local"
+BusOut leds(LED1, LED2, LED3, LED4);
+
+int main() {
+ leds = 0x0;
+ float right_pos, left_pos;
+ FILE *fp = fopen("/local/config.txt", "r"); // Open "config.txt" for reading
+ leds = 0x1;
+ fscanf(fp, "r:%f,l:%f", &right_pos, &left_pos);
+ leds = 0x2;
+ fclose(fp);
+ leds = 0x3;
+
+ // servos
+ Servo left_s(p21);
+ Servo right_s(p22);
+
+ left_s.calibrate_max(0.0007);
+ left_s.calibrate_min(-0.0014);
+ right_s.calibrate(0.0009);
+
+ leds = 0x4;
+
+ left_s = right_s = 1.0;
+
+ wait(1);
+
+ leds = 0x5;
+
+ right_s = right_pos;
+ left_s = left_pos;
+
+ leds = 0xF;
+
+ AnalogIn battery(p19);
+ DigitalOut battery_warning(p24);
+ battery_warning = 1;
+
+ const float BAT_MUL = 10.26;
+ float battery_voltage;
+
+ while(1) {
+ battery_voltage = battery.read() * BAT_MUL;
+ if(battery_voltage < 6.4)
+ battery_warning = 0;
+ if(battery_warning == 0 && battery_voltage > 6.4)
+ battery_warning = 1;
+
+ wait(1.0);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 08 21:43:41 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc \ No newline at end of file
