Affordable Smart Wheelchair / wheelchaircontrol3

Dependencies:   QEI2 chair_BNO055 PID VL53L1X_Filter

Dependents:   Integrated

Files at this revision

API Documentation at this revision

Comitter:
ryanlin97
Date:
Thu Jul 12 18:36:09 2018 +0000
Child:
1:c0beadca1617
Commit message:
Symbol__user_perthread_libspace multiply defined compilation error;

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
wheelchair.cpp Show annotated file Show diff for this revision Revisions of this file
wheelchair.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Thu Jul 12 18:36:09 2018 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 12 18:36:09 2018 +0000
@@ -0,0 +1,75 @@
+#include "wheelchair.h"
+
+Serial pc(USBTX, USBRX);
+
+DigitalOut off(D0);
+DigitalOut on(D1);
+DigitalOut up(D2);
+DigitalOut down(D3);
+int main(void)
+{
+/*    Wheelchair smart(xDir,yDir);
+    on = 1;
+    while(1){
+    if( pc.readable()) {
+        char c = pc.getc();
+        if( c == 'w') {
+            pc.printf("up \n");
+            smart.forward(); 
+            }
+        
+        else if( c == 'd') {
+            pc.printf("left \n");
+            smart.left();
+            }
+        
+        else if( c == 'a') {
+            pc.printf("right \n");
+            smart.right();
+            }
+        
+        else if( c == 's') {
+            pc.printf("down \n");
+            smart.backward();
+            }
+        
+        else {
+            pc.printf("none \n");
+            smart.stop();
+            if( c == 'o') {
+               pc.printf("turning on");
+               on = 0;
+               wait(process);
+               on = 1; 
+                }
+            
+            else if( c == 'k') {
+                off = 0;
+                wait(process);
+                off = 1;
+                }
+        
+            else if( c == 'u') {
+                up = 0;
+                wait(process);
+                up = 1;
+                }
+        
+            else if( c == 'p') {
+                down = 0;
+                wait(process);
+                down = 1;
+                }
+            }
+           }
+           
+    else {
+       pc.printf("nothing pressed \n");
+       smart.stop();
+            }
+    
+    wait(process);
+       }
+*/
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Thu Jul 12 18:36:09 2018 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#62f8b922b420626514fd4690107aff4188469833
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wheelchair.cpp	Thu Jul 12 18:36:09 2018 +0000
@@ -0,0 +1,34 @@
+#include "wheelchair.h"
+/*
+Wheelchair::Wheelchair(PinName xPin, PinName yPin){
+       x = new AnalogOut(xPin);
+       y = new AnalogOut(yPin);       
+    }
+
+void Wheelchair::move(float degrees){
+    }
+    
+void Wheelchair::forward(){
+    x->write(high);
+    y->write(def);
+}
+
+void Wheelchair::backward(){
+    x->write(low);
+    y->write(def);
+}
+
+void Wheelchair::right(){
+    x->write(def);
+    y->write(high);
+}
+
+void Wheelchair::left(){
+    x->write(def);
+    y->write(low);
+}
+
+void Wheelchair::stop(){ 
+    x->write(def);
+    y->write(def);
+}*/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wheelchair.h	Thu Jul 12 18:36:09 2018 +0000
@@ -0,0 +1,29 @@
+#ifndef wheelchair
+#define wheelchair
+
+#include "mbed.h"
+
+#define def (2.5f/3.3f)
+#define high 3.3f
+#define low (1.5f/3.3f)
+#define process .1
+#define xDir PA_4 //top right two pins
+#define yDir D13 //top left two pins
+
+class Wheelchair
+{
+public:
+    /*Wheelchair(PinName xPin, PinName yPin);
+      void move(float degrees);
+      void forward();
+      void backward();
+      void right();
+      void left();
+      void stop();
+
+    private:
+      AnalogOut* x;
+      AnalogOut* y;
+    */
+};
+#endif
\ No newline at end of file