h

Dependencies:   Motor QEI Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
caleblegis
Date:
Thu Mar 10 16:18:01 2016 +0000
Commit message:
updated

Changed in this revision

Motor.lib Show annotated file Show diff for this revision Revisions of this file
QEI.lib Show annotated file Show diff for this revision Revisions of this file
Servo.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
turret.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r f8f608a6114a Motor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.lib	Thu Mar 10 16:18:01 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Motor/#f265e441bcd9
diff -r 000000000000 -r f8f608a6114a QEI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QEI.lib	Thu Mar 10 16:18:01 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/aberk/code/QEI/#5c2ad81551aa
diff -r 000000000000 -r f8f608a6114a Servo.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Thu Mar 10 16:18:01 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ES309-Project-Team/code/Servo/#144da4a34b45
diff -r 000000000000 -r f8f608a6114a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 10 16:18:01 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file
diff -r 000000000000 -r f8f608a6114a turret.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/turret.cpp	Thu Mar 10 16:18:01 2016 +0000
@@ -0,0 +1,58 @@
+#include "mbed.h"
+#include "Servo.h"
+#include "Motor.h"
+#include "QEI.h"
+#define pi (3.14159265)
+#define logfreq (100)
+#define data_pts (500)
+Serial pc(USBTX, USBRX);
+Motor m(p25, p23, p27);
+
+QEI enc(p16,p17,NC,3200);
+
+
+
+float motspeed;
+float x;
+float rad;
+int count;
+
+int main()
+{
+   enc.reset();
+   printf("enter a angle\r\n");
+    scanf("%f", &x);
+
+   
+    
+   while(1){
+        m.speed(0.25);
+   wait(1/logfreq);
+   
+   count = enc.getPulses() ;
+   rad = count*((2*pi)/1600) ;
+   if (rad<x){
+   m.speed(0);}
+   printf("The pulses are: %f\n\r", rad);}
+   
+    
+    //0.2 for forward torque
+    //-0.5 for backward
+    
+
+        //for (servopos=0; servopos<=1.0; servopos+=0.1){
+        //for (motspeed= 0.2; motspeed <= 1.0; motspeed += 0.1) {
+            //myservo1 = servopos;
+            //myservo2 = 1.0 - servopos;
+            //printf("Servo 1 position %.2f  Servo 2 position %.3f\n", servopos, (1-servopos));
+
+            //m.speed(motspeed);
+            //printf("motor speed is %.2f\n", motspeed);
+            //wait(0.0002);
+            //m.speed(-1.0);
+            //wait(0.002);
+            //m.speed(1.0);
+        }
+
+
+