homework

Dependencies:   mbed

main.cpp

Committer:
Kojiro
Date:
2014-04-21
Revision:
1:3917701817b4
Parent:
0:5193eafa81b6
Child:
2:46e449180029

File content as of revision 1:3917701817b4:

#include "mbed.h"

BusOut leds(P1_13, P1_14, P1_22, P0_17, P0_18, P0_19, P1_15, P0_1);

void rotate();
void all();
void sitei();

int main()
{

    while(1)
    {
        rotate();
        wait(0.25);
        all();    
        wait(0.25);
        sitei();
        wait(0.25);
    }
}

void all()

{
 
 leds = 0xff;
 wait(0.125);
 leds = 0x00;
  wait(0.125);
 }
 
  
void rotate()
{
    volatile uint8_t i;
    for(i = 0x00; i < 8; i++)
    {
        leds = 1 << i;
        wait(0.125);
    }

    for(i = 7; i > 0x00; i--)
    {
        leds = 1 << i;
        wait(0.125);
        
       
    }
    leds = 0x01;
     wait(0.125);\
}

void sitei()
{
    

        leds = 0x04;
        wait(0.125);
    }