Script om de servomotor uit te proberen
main.cpp
- Committer:
- lisa96m
- Date:
- 2016-10-20
- Revision:
- 1:acd79b94fe6a
- Parent:
- 0:ebffc70ade24
File content as of revision 1:acd79b94fe6a:
#include "mbed.h" #define SERIAL_BAUD 115200 Serial pc(USBTX, USBRX); PwmOut servo(A4); volatile double x = 0; void loop() { double y = sin(x); { x = x+0.2; } servo = abs(y); pc.printf("grootte van sinus is %f.\r\n", abs(y)); pc.printf("grootte van x is %f.\r\n", x); } int main() { pc.baud(SERIAL_BAUD); servo.period(0.020); while(true) { loop(); wait(2); } }