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:cbf3d33db709, committed 2015-10-16
- Comitter:
- jfields
- Date:
- Fri Oct 16 17:17:41 2015 +0000
- Commit message:
- serv
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Oct 16 17:17:41 2015 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "rtos.h"
+
+PwmOut servo1(p25);
+PwmOut servo2(p24);
+
+// Threads
+void bpc_func(void const *args);
+Thread * bpc_thread;
+
+float dty_servo_open = 0.1125; // PCT [3.75-11.25]
+float dty_servo_close = 0.0375; // PCT [3.75-11.25]
+float period = 0.02; // sec
+
+AnalogIn Button(p15); // elevator button press Voltage = 3.3*0.2*n ; n = Floor Number
+
+
+int main() {
+
+ servo1.period(period);
+ servo2.period(period);
+ bpc_thread = new Thread(bpc_func); // start button checker thread
+
+
+ while(1) {
+
+ }
+}
+
+void bpc_func(void const *args) {
+ while (1) {
+ float ADC_val = Button.read();
+ int val = ADC_val*10;
+ if(val == 2) {
+ // blah
+ } else if(val == 4) {
+ // blah
+ } else if(val == 6) {
+ // blah
+ } else if(val == 8) {
+ servo1.write(dty_servo_open);
+ servo2.write(dty_servo_open);
+ } else if(val == 10) {
+ servo1.write(dty_servo_close);
+ servo2.write(dty_servo_close);
+ }
+ wait(0.1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Fri Oct 16 17:17:41 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#12552ef4e980
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 16 17:17:41 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file