jin young sung / Mbed 2 deprecated Led Clock Download Featured

Dependencies:   mbed

main.cpp

Committer:
darzento
Date:
2015-06-01
Revision:
9:724d3e39ded8
Parent:
8:b162bf17271f

File content as of revision 9:724d3e39ded8:

#include "mbed.h"

/*****************************************************************************
******************************************************************************
******************************************************************************
******************************************************************************
******************************************************************************/

DigitalOut myled(LED1);
DigitalOut frame();          //Clock frame
DigitalOut dot_Point();      //Time point
BusOut hour();               //Hour hand
BusOut minute();             //Minute hand
BusOut 
InterruptIn hall();          //Hall sensor sensing interrupt
Timer timer;

void hour_hand(void);
void minute_hand(void);
void sensor();

int i=0;

int main() 
{
    hall.rise(&sensor);      //rising edge operating
    int a = 0;
    
    while(1)
    {    
        frame = 1;
        hour_hand();
        minute_hand();
        if (i==10)
        {
            timer.start();
        }
        if (i==11)
        {
            timer.stop();
            
            a = timer.read();
        }
    }
}
void sensor()
{
     i=i+1;
}

void hour_hand(void)
{
     hour = 0x1F;
     wait ();
     hour = 0x00;
     wait ();
}
void minute_hand(void)
{
     minute = 0x0FF;
     wait ();
     minute = 0x00;
     wait();
}