elektro hiof / Mbed 2 deprecated Oppgave4-4

Dependencies:   mbed

Fork of Oppgave4-4 by elektro hiof

main.cpp

Committer:
tors
Date:
2014-10-17
Revision:
1:e6e3af75f623
Parent:
0:c26cdf21261a

File content as of revision 1:e6e3af75f623:

#include "mbed.h"
DigitalOut LR(p18);
DigitalIn  B1(p15);
float t = 2.0;
int main()
{

    while(1) {
        if(!B1)
        {
            t = 2.0;
            wait(t);
            LR = 1;
            wait(t);
            LR = 0;
        }
        else
        {
           if(t >= 0.2)
           {
            t -= 0.2;
            }
            wait(t);
            LR = 1;
            wait(0.2);
            LR = 0;   
        }
    }
}