Aufgabe 1. BusOut Programm

Dependencies:   mbed

main.cpp

Committer:
riad
Date:
2020-01-12
Revision:
3:e090a9b08c31
Parent:
2:ae17974ea4a6

File content as of revision 3:e090a9b08c31:

#include "mbed.h"

BusOut lb(LED1,LED2,LED3,LED4);
DigitalIn joy(BUTTON1);

void lb1 ();

int main ()
{
    while(1)
    {
        if(joy)
        {
        lb1 ();
        }
        wait_ms(100);
    }
}

void lb1 ()
{
    lb = 1;
    wait_ms(100);
    
    for(int i = 0; i<=7; i++)
        {
        lb = lb << 1;
        lb = lb | 1;
        wait_ms(100);
        }
        
        lb = 15;
    wait_ms(100);
    
    for(int i = 0; i<=7; i++)
        {
        lb = lb >> 1;
        lb = lb | 1;
        wait_ms(100);
        }
}