Script om de servomotor uit te proberen
Diff: main.cpp
- Revision:
- 0:ebffc70ade24
- Child:
- 1:acd79b94fe6a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 20 07:31:33 2016 +0000 @@ -0,0 +1,29 @@ +#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); + } +} \ No newline at end of file