Motor component testing

Dependencies:   Encoder HIDScope mbed

Revision:
0:2240263f7068
diff -r 000000000000 -r 2240263f7068 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 23 09:09:24 2014 +0000
@@ -0,0 +1,60 @@
+#include "mbed.h"
+#include "encoder.h"
+//#include "HIDScope.h"
+#include "PwmOut.h"
+#define M1_PWM PTA5
+#define M1_DIR PTA4
+
+Encoder motor1(PTD3,PTD1, true);
+PwmOut pwm_motor1(M1_PWM);
+DigitalOut motordir1(M1_DIR);
+DigitalOut LED(LED_GREEN);
+
+float PWM = 0.2; /// (1000/200); 
+//HIDScope scope(3);
+    
+int main() {
+    //pwm_motor1.period_us(100);
+    //pwm_motor1.write(PWM);  
+    LED = 0;
+    motordir1 = 1; 
+    while(true) {
+            //wait(3);
+            pwm_motor1.write(0.4);
+            LED = 1;
+            //wait(1);
+            //PWM = PWM + 0.05; 
+          
+            //pwm_motor1.pulsewidth_us(50);
+ 
+            //scope.set(0, motor1.getPosition());
+            //scope.set(1, DigitalIn(PTD3)); 
+            //scope.set(2, DigitalIn(PTD1)); 
+            //scope.send();
+            //wait(0.01);
+        
+        /*
+        while (PWM > 0) {
+            PWM = PWM - 0.005; 
+            motordir1 = 0; 
+            pwm_motor1.write(PWM); 
+            scope.set(0, motor1.getPosition());
+            scope.set(1, DigitalIn(PTD3)); 
+            scope.set(2, DigitalIn(PTD1)); 
+            scope.set(3, pwm_motor1);
+            scope.send();
+            wait(0.005);
+            }
+        while (PWM < 1) {
+            PWM = PWM + 0.005;
+        motordir1 = 0; 
+        pwm_motor1.write(PWM);
+        scope.set(0, motor1.getPosition());
+        scope.set(1, DigitalIn(PTD3)); 
+        scope.set(2, DigitalIn(PTD1)); 
+        scope.set(3, pwm_motor1);
+        scope.send();
+        wait(0.005);
+            }*/
+        }
+}