Oppgave 5.1 d original

Dependencies:   mbed

Fork of Oppgav51d by Sølibatgutt

Committer:
Smashftw
Date:
Tue Oct 03 10:50:11 2017 +0000
Revision:
1:e06a4eff4a74
Parent:
0:b34cb9ed7646
Oppgave 51d

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Smashftw 0:b34cb9ed7646 1 #include "mbed.h"
Smashftw 0:b34cb9ed7646 2
Smashftw 0:b34cb9ed7646 3 DigitalOut myled(LED1);
Smashftw 1:e06a4eff4a74 4 void blink3(float F, float d);
Smashftw 1:e06a4eff4a74 5
Smashftw 1:e06a4eff4a74 6 int main()
Smashftw 1:e06a4eff4a74 7 {
Smashftw 1:e06a4eff4a74 8 int n = 20;
Smashftw 1:e06a4eff4a74 9 while(n>0) {
Smashftw 1:e06a4eff4a74 10 blink3(2.0, 0.4);
Smashftw 0:b34cb9ed7646 11 n--;
Smashftw 1:e06a4eff4a74 12 }
Smashftw 1:e06a4eff4a74 13 return 0;
Smashftw 0:b34cb9ed7646 14 }
Smashftw 0:b34cb9ed7646 15
Smashftw 1:e06a4eff4a74 16 void blink3(float F, float d)
Smashftw 1:e06a4eff4a74 17 {
Smashftw 0:b34cb9ed7646 18 myled=1;
Smashftw 0:b34cb9ed7646 19 wait(d/F);
Smashftw 0:b34cb9ed7646 20 myled=0;
Smashftw 0:b34cb9ed7646 21 wait((1-d)/F);
Smashftw 1:e06a4eff4a74 22 }