ARM Mbed with switch and led game.

Dependencies:   mbed

main.cpp

Committer:
mrbhatter
Date:
2018-05-16
Revision:
0:0ae90b4ea12e

File content as of revision 0:0ae90b4ea12e:

#include "mbed.h"

DigitalOut myled(LED_GREEN);
DigitalIn s(PTC9);
Serial pc(USBTX, USBRX);

int c;
float t=1.0f;
int main()
{
   
    while (1) 
    {
         for(c=0;c<=100;c++)
         {
             pc.printf("%d \n", c);
             if(s==0 && c%10==0)
             {
                 myled=0;
                 t=t-0.3;
                 wait(4);
                 
             }
             else
             {
                 myled=1;
                 wait(t);
                 
             }
        }
    }
}