servo motor werkt eindelijk!!!! wiehoe!!!

Dependencies:   mbed QEI Servo HIDScope biquadFilter MODSERIAL FastPWM

main.cpp

Committer:
IsaRobin
Date:
2019-10-29
Revision:
1:1b33fd02e6b1
Parent:
0:009a005982e5
Child:
2:f92eadfd1a27

File content as of revision 1:1b33fd02e6b1:

/* servo motor program - biorbotics groep 8 */

#include <Servo.h>
#include <mbed.h>
#include <math.h>    /* cos */
#include <MODSERIAL.h>


MODSERIAL pc(USBTX, USBRX);


Servo myservo(D3);


int main()
{
    pc.baud(115200);
    pc.printf("starting main .\r.\n");
    myservo.Enable(1500,20000);

    while(true) {
        pc.printf("starting");
        for (int pos = 1000; pos < 2000; pos += 10) {
            myservo.SetPosition(pos);
            wait_ms(20);
        }
        for (int pos = 2000; pos > 1000; pos -= 10) {
            myservo.SetPosition(pos);
            wait_ms(20);
        }
    }

}