Script om de servomotor uit te proberen

Dependencies:   mbed mbed

main.cpp

Committer:
lisa96m
Date:
2016-10-20
Revision:
0:ebffc70ade24
Child:
1:acd79b94fe6a

File content as of revision 0:ebffc70ade24:

#include "mbed.h"

#define SERIAL_BAUD 115200

Serial pc(USBTX, USBRX);

PwmOut servo(A4);
double x = 0;
float pi = 3.14;


void loop()
{
    double y = sin(x);
    {
        x++;
    }
    servo = abs(y);
    pc.printf("grootte van sinus is %f.\r\n", abs(y));
}

int main()
{
    pc.baud(SERIAL_BAUD);
    while(true) {
        loop();
        wait(10);
    }
}