in de avond na marnick1

Dependencies:   mbed Servo MODSERIAL FXOS8700Q

main.cpp

Committer:
jasperkessels
Date:
2019-10-29
Revision:
0:009a005982e5

File content as of revision 0:009a005982e5:

/* 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()
{
myservo.Enable(1500,20000);

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

}