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.
Fork of Quadrocopter by
Diff: main.cpp
- Revision:
- 17:de729cb71f1e
- Parent:
- 16:59d80bf88bf8
- Child:
- 18:78e7de067ddb
--- a/main.cpp Mon Aug 28 11:20:17 2017 +0000 +++ b/main.cpp Mon Sep 11 07:49:00 2017 +0000 @@ -39,37 +39,44 @@ anlernen(&Motor1, &Motor2, &Motor3, &Motor4, &taster1, &taster2, &taster4); } pc.printf("Druecke Taster1 fuer den Start\n\r"); - uint16_t drehzahl=700; + n1=n2=n3=n4=700; if (taster1) { - uint16_t flanke2,hilfe2=0,flanke3,hilfe3=0; + uint16_t flanke1,hilfe1=0,flanke2,hilfe2=0,flanke3,hilfe3=0,flanke4,hilfe4=0; pc.printf("Taster-Modus aktiv\n\r"); + n1=n2=n3=n4=625; while(1) { flanke2 = taster2; if ((flanke2 != 0) && (hilfe2 == 0)) { - drehzahl+=5; + n1+=50; + n2+=50; + n3+=50; + n4+=50; } hilfe2=flanke2; flanke3 = taster3; if ((flanke3 != 0) && (hilfe3 == 0)) { - drehzahl-=5; + n1-=50; + n2-=50; + n3-=50; + n4-=50; } hilfe3=flanke3; - if(taster4) - { - drehzahl=0; + flanke4 = taster4; + if ((flanke4 != 0) && (hilfe4 == 0)) + { + n1=n2=n3=n4=625; } - n1 = n2 = n3 = n4 = drehzahl; + hilfe4=flanke4; Motor1.pulsewidth_us(n1); Motor2.pulsewidth_us(n2); Motor3.pulsewidth_us(n3); Motor4.pulsewidth_us(n4); - - pc.printf("Drehzahl = %d\r",drehzahl); + pc.printf("Drehzahl= %d\r= %d",n1); } }