![](/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:
- 4:d3e8ec68ff97
- Parent:
- 3:f30c2ded1a58
- Child:
- 5:e21d303d62d8
File content as of revision 4:d3e8ec68ff97:
/* servo motor program - biorbotics group 8 */ #include <Servo.h> #include <mbed.h> #include <math.h> /* cos */ #include <MODSERIAL.h> MODSERIAL pc(USBTX, USBRX); //connect pc Servo myservo(D3); //the servo motor is connected to pin D3 on the BioRobotics shield //Buttons that will be used to control the servo motor InterruptIn button2(SW2); //when this button is pushed, the servo motor rotates 90 degrees counterclockwise InterruptIn button3(SW3); //when this button is pushed, the servo motor rotates 90 degrees clockclockwise void showcard() { myservo.SetPosition(2000); pc.printf("card is being showed to user.\n.\r"); } void hidecard() { myservo.SetPosition(1000); pc.printf("card is being rotated away from user .\n.\r"); } int main() { pc.baud(115200); pc.printf("starting main .\r.\n"); myservo.Enable(1000,20000); button2.rise(showcard); button3.rise(hidecard); while(true) { pc.printf("weer begonnen aan mijn main"); //@Jasper hebben we deze nog echt nodgi wait(2); } }