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
--- /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
--- /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
--- /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
--- /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
--- /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);
+        }
+
+
+