for ros

Dependencies:   QEI chair_BNO055 pid ros_lib_kinetic

Dependents:   wheelchaircontrolrealtimeROS

Fork of wheelchaircontrol by ryan lin

Revision:
3:a5e71bfdb492
Parent:
1:c0beadca1617
Child:
4:29a27953fe70
--- a/wheelchair.cpp	Thu Jul 12 20:51:54 2018 +0000
+++ b/wheelchair.cpp	Mon Jul 16 20:46:42 2018 +0000
@@ -2,18 +2,24 @@
 
 Wheelchair::Wheelchair(PinName xPin, PinName yPin)
 {
-    x = new AnalogOut(xPin);
-    y = new AnalogOut(yPin);
+    x = new PwmOut(xPin);
+    y = new PwmOut(yPin);
 }
-
-void Wheelchair::move(float degrees)
+/*
+* joystick has analog out of 200-700, scale values between 1.3 and 3.3
+*/
+void Wheelchair::move(float x_coor, float y_coor)
 {
+    printf("x is %f y is %f \n", 1.6*x_coor + 2.5, 1.6*y_coor + 2.5 + offset); 
+    x->write(1.6*x_coor + 2.5);
+    y->write(1.6*y_coor + 2.5 + offset);
+    
 }
 
 void Wheelchair::forward()
 {
     x->write(high);
-    y->write(def);
+    y->write(def+offset);
 }
 
 void Wheelchair::backward()