Lejla Agic Aldin Kiselica

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut myled(LED3);
00004 
00005 int main() {
00006     float turnOn = 1.0;
00007     float turnOff = 1.0;
00008     float k = 0.06;
00009     while(1) {
00010         myled = 0;
00011         wait(1);
00012         myled = 1;
00013         wait(1);
00014         while(turnOff >= 0.1){
00015                 turnOff -= k;
00016                 turnOn += k;
00017                 myled = 0;
00018                 wait(turnOn);
00019                 myled = 1;
00020                 wait(turnOff);
00021          }
00022          
00023         while(turnOn >= 0.1){
00024              turnOn -= k;
00025              turnOff += k;
00026              myled = 1;
00027              wait(turnOff);
00028              myled = 0;
00029              wait(turnOn);
00030          }
00031                   
00032          myled = 1;
00033     }
00034 }