Nieuwe versietje

Dependencies:   MODSERIAL mbed

Fork of PWM_motor by Casper Maas

Revision:
1:2ec710725db2
Parent:
0:0cb350eb704a
Child:
2:c63f3fab88d9
--- a/main.cpp	Fri Sep 28 09:42:48 2018 +0000
+++ b/main.cpp	Fri Sep 28 09:58:57 2018 +0000
@@ -1,19 +1,21 @@
 #include "mbed.h"
 #include "MODSERIAL.h"
 
-AnalogIn pot1(A1);
-AnalogIn pot2(A2);
-DigitalIn encoder(D7);
-PwmOut pwmpin(D5);
+//AnalogIn pot1(A1);
+//AnalogIn pot2(A2);
+DigitalIn encoder(D8);
+PwmOut pwmpin1(D5);
+PwmOut pwmpin2(D6);
 DigitalOut directionpin(D4);
-DigitalOut directionpin2(D6);
+DigitalOut directionpin2(D7);
 MODSERIAL pc(USBTX, USBRX);
 
 int main()
 {
         pc.baud(9600);
     
-    pwmpin.period_us(60); //60 microsecondsPWM period, 16.7 kHz
+    pwmpin1.period_us(60); //60 microsecondsPWM period, 16.7 kHz
+    pwmpin2.period_us(60);
    //float ain1;
    //float ain2;
     
@@ -23,7 +25,8 @@
         
         float u = -0.9f; //determineusefulvalue, -0.3f is justanexample
         directionpin= u > 0.0f; //eithertrueor false
-        pwmpin= fabs(u); //pwmduty cycle canonlybepositive, floatingpoint absolute value
+        pwmpin1= fabs(u); //pwmduty cycle canonlybepositive, floatingpoint absolute value
+        pwmpin2= fabs(u);
         
         wait(0.5f);