s
Dependencies: mbed
Fork of LAB08_Oppgave1 by
main.cpp@1:8717e146d58f, 2015-10-22 (annotated)
- Committer:
- Voldread
- Date:
- Thu Oct 22 15:07:50 2015 +0000
- Revision:
- 1:8717e146d58f
- Parent:
- 0:cf9946c35521
s
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rlanghbv | 0:cf9946c35521 | 1 | #include "mbed.h" |
rlanghbv | 0:cf9946c35521 | 2 | |
rlanghbv | 0:cf9946c35521 | 3 | PwmOut pwmLed(PB_9); |
rlanghbv | 0:cf9946c35521 | 4 | |
rlanghbv | 0:cf9946c35521 | 5 | int main() |
rlanghbv | 0:cf9946c35521 | 6 | { |
rlanghbv | 0:cf9946c35521 | 7 | pwmLed.period(0.020); // 20ms Periode tid |
rlanghbv | 0:cf9946c35521 | 8 | |
rlanghbv | 0:cf9946c35521 | 9 | //Set the led ouput duty-cycle to 1% |
rlanghbv | 0:cf9946c35521 | 10 | float brightness=0.01; |
rlanghbv | 0:cf9946c35521 | 11 | pwmLed=brightness; |
rlanghbv | 0:cf9946c35521 | 12 | |
Voldread | 1:8717e146d58f | 13 | |
rlanghbv | 0:cf9946c35521 | 14 | while(1) { |
rlanghbv | 0:cf9946c35521 | 15 | |
Voldread | 1:8717e146d58f | 16 | printf("Hva skal lysstyrken vere?\n"); |
Voldread | 1:8717e146d58f | 17 | scanf("%f", &brightness); |
rlanghbv | 0:cf9946c35521 | 18 | //Set the ouput duty-cycle, specified as a percentage |
rlanghbv | 0:cf9946c35521 | 19 | pwmLed = brightness; |
Voldread | 1:8717e146d58f | 20 | printf("%1.3f \n \r",brightness); |
rlanghbv | 0:cf9946c35521 | 21 | } |
rlanghbv | 0:cf9946c35521 | 22 | } |
rlanghbv | 0:cf9946c35521 | 23 |