![](/media/cache/group/9e3cc099b3b04bca937a1cca1da81b19.jpg.50x50_q85.jpg)
servo motor werkt eindelijk!!!! wiehoe!!!
Dependencies: mbed QEI Servo HIDScope biquadFilter MODSERIAL FastPWM
main.cpp
- Committer:
- IsaRobin
- Date:
- 2019-10-29
- Revision:
- 3:f30c2ded1a58
- Parent:
- 2:f92eadfd1a27
- Child:
- 4:d3e8ec68ff97
File content as of revision 3:f30c2ded1a58:
/* 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); //Buttons InterruptIn button2(SW2); InterruptIn button3(SW3); void kantelheen() { myservo.SetPosition(2000); pc.printf("heeft gekanteld heen.\n.\r"); } void kantelterug() { myservo.SetPosition(1000); pc.printf("heeft terug gekanteld .\n.\r"); } int main() { pc.baud(115200); pc.printf("starting main .\r.\n"); myservo.Enable(1000,20000); button2.rise(kantelheen); button3.rise(kantelterug); while(true) { pc.printf("weer begonnen aan mijn main"); wait(2); } } /* pc.printf("starting.\r.\n"); for (int pos = 1410; pos < 1590; pos += 5) { myservo.SetPosition(pos); wait_ms(20); } pc.printf("kant 1.\r.\n"); for (int pos = 1590; pos > 1410; pos -= 5) { myservo.SetPosition(pos); wait_ms(20); } pc.printf("kant 2.\r.\n"); } */