Enil Pajić Aida Pločo

Dependencies:   mbed

main.cpp

Committer:
tim007
Date:
2014-03-03
Revision:
0:5fd44252399a

File content as of revision 0:5fd44252399a:

#include "mbed.h"
 
DigitalOut myled(LED2);
 
int main() {
    while(1) {
        myled = 0;
        wait(1);
        myled = 1;
        wait(1);
        const double e = 0.9/30.0;
        double f = 1 + e;               // 1.03
        double h = 1 - e;               // 1 - 0.03
        for (int a = 0; a < 30; ++a)
            {
                myled = 0;              // Ukljucena
                wait (f);               // za 1.03 pa 1.06, 1.09 ... pa 1.9
                f += e;
                myled = 1;              // Iskljucena
                wait (h);               // za 0.97, pa 0.94 ... pa 0.1
                h -= e;
            }
        f = 1 - e;
        h = 1 + e;
        for (int a = 0; a < 60; ++a)
            {
                myled = 0;
                wait (f);
                f -= e;
                myled = 1;
                wait (h);
                h += e;
 
            }
    }
}