Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of LAB08_Oppgave2 by
Revision 2:0b40c69501b4, committed 2015-10-23
- Comitter:
- madmonkeyman82
- Date:
- Fri Oct 23 15:08:37 2015 +0000
- Parent:
- 1:e5f12ffcf32f
- Commit message:
- LAB08_Oppgave4
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 21 11:10:55 2015 +0000 +++ b/main.cpp Fri Oct 23 15:08:37 2015 +0000 @@ -1,17 +1,25 @@ #include "mbed.h" + PwmOut servoMotor(PA_7); +AnalogIn pot(PA_1); +DigitalOut HIGH(PA_0); +DigitalOut GND(PA_4); int main() { //sørg for å at servoMotor pulsen har en // Periode tid på .01 sek + servoMotor.period(0.010); + HIGH=1; + GND=0; while (true) { - //Roter Servo hodet minus 60 grader - // servoMotor har pusbredde på 1000 us - wait(0.2); - //Roter Servo hodet pluss 60 grader - // servoMotor har pusbredde på 2000 us - wait(0.2); + + servoMotor.pulsewidth_us(1000+pot.read()*1000); + + + printf("PWM : %f\r\n", servoMotor.read() ); + + } }