elke 2 sec verandering van richting

Dependencies:   Encoder HIDScope MODSERIAL mbed-dsp mbed

Fork of BMT-M9_motorcontrol by First Last

Files at this revision

API Documentation at this revision

Comitter:
Hooglugt
Date:
Fri Oct 17 10:57:44 2014 +0000
Parent:
15:979011e26ca3
Commit message:
pwm waarden in de looper (2 en -2), werking clamp

Changed in this revision

MODSERIAL.lib 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
--- a/MODSERIAL.lib	Fri Oct 17 10:51:38 2014 +0000
+++ b/MODSERIAL.lib	Fri Oct 17 10:57:44 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Sissors/code/MODSERIAL/#2e4e3795a093
+http://developer.mbed.org/users/Hooglugt/code/MODSERIAL/#2e4e3795a093
--- a/main.cpp	Fri Oct 17 10:51:38 2014 +0000
+++ b/main.cpp	Fri Oct 17 10:57:44 2014 +0000
@@ -21,7 +21,7 @@
 
 void looper()
 {
-    if (new_pwm==2) {
+    if (new_pwm==2) { // 2 en -2 om aan te tonen dat clamp function ook werkt
         new_pwm = -2;
     } else {
         new_pwm = 2;
@@ -31,18 +31,18 @@
 
 int main()
 {
-    //motor 1, 25D 
+    //motor 1, 25D
     Encoder motor1(PTD3, PTD5);
     DigitalOut motor1dir(PTC9);
     PwmOut pwm_motor1(PTC8);
-    pwm_motor.period_us(100); //10kHz PWM frequency    
-    
-    //motor 2, 25D 
+    pwm_motor.period_us(100); //10kHz PWM frequency
+
+    //motor 2, 25D
     Encoder motor2(PTD2,PTD0);
     DigitalOut motor2dir(PTA4);
     PwmOut pwm_motor2(PTA5);
-    
-    pwm_motor.period_us(100); //10kHz PWM frequency    
+
+    pwm_motor.period_us(100); //10kHz PWM frequency
     Ticker looptimer;
     looptimer.attach(setlooptimerflag,TSAMP);
     Ticker flip_switch;