Programma om motor 1 aan te sturen

Dependencies:   Encoder MODSERIAL mbed-dsp mbed

Fork of motor1aansturing by BMT M9 Groep01

Revision:
28:fa85793c50bb
Parent:
27:fb73c8b5321a
--- a/motor2.cpp	Mon Oct 20 07:37:46 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#include "mbed.h"
-#include "encoder.h"
-
-int main()
-{
-    Encoder motor1(PTD0,PTC9);
-    PwmOut pwm_motor(PTA5);
-    pwm_motor.period_us(100);
-    DigitalOut motordir(PTD1);
-    int pos = 0; // variable to store the servo position
-}
-
-void loop()
-{
-for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees, limit to other degree?
-{ // in steps of 1 degree
-pwm_motor.write(pos); // tell motor to go to position in variable 'pos'
-delay(15); // waits 15ms for the motor to reach the position
-}
-
-//back to starting position:
-for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
-{
-pwm_motor.write(pos); // tell servo to go to position in variable 'pos'
-delay(15); // waits 15ms for the servo to reach the position
\ No newline at end of file