s
Dependencies: mbed
Fork of LAB08_Oppgave1 by
Revision 1:8717e146d58f, committed 2015-10-22
- Comitter:
- Voldread
- Date:
- Thu Oct 22 15:07:50 2015 +0000
- Parent:
- 0:cf9946c35521
- Commit message:
- s
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 21 09:50:57 2015 +0000 +++ b/main.cpp Thu Oct 22 15:07:50 2015 +0000 @@ -10,18 +10,14 @@ float brightness=0.01; pwmLed=brightness; - printf("Press 'u' to turn LED1 brightness up, 'd' for down\n\r"); + while(1) { - char c = getchar(); - if((c == 'u') && (brightness < 0.1f)) - brightness += 0.001f; - if((c == 'd') && (brightness > 0.0f)) - brightness -= 0.001f; - + printf("Hva skal lysstyrken vere?\n"); + scanf("%f", &brightness); //Set the ouput duty-cycle, specified as a percentage pwmLed = brightness; - printf("%c %1.3f \n \r",c,brightness); + printf("%1.3f \n \r",brightness); } }