Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- wipflhan
- Date:
- 2016-10-24
- Revision:
- 0:ab33946a7709
File content as of revision 0:ab33946a7709:
#include "mbed.h"
// LSB... ...MSB
// 2^0 2^1 ...........
BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);
// D20 D19 D18.....
void LedBarTest();
void Lauflicht();
void einschieben(int anzahl);
void rechtsschieben(int anzahl);
void linksschieben(int anzahlt);
int zeit = 25;
int main()
{
bool flag = true;
lb = 1;
wait_ms(zeit);
einschieben(2);
while(lb != 0) {
if (flag == true)zeit *= 2;
else zeit /=2;
linksschieben(9);
rechtsschieben(9);
flag = !flag;
}
}
//void LedBarTest()
//{
// lb = 1; //D20 setzen
// wait_ms(500);
// lb = 2; //D19 setzen
// wait_ms(500);
// lb = 3; //D20 & 19setzen
// wait_ms(500);
// lb = 4; // setzen
// wait_ms(500);
//}
void Lauflicht()
{
lb = 1;
wait_ms(zeit);
while(lb != 0) {
lb = lb <<1;
wait_ms(zeit);
}
}
void einschieben(int anzahl)
{
for(int i = 0; i < anzahl; i++) {
lb = lb << 1;
lb = lb | 1;
wait_ms(zeit);
}
}
void linksschieben(int anzahl)
{
for(int i = 0; i < anzahl; i++) {
lb = lb << 1;
wait_ms(zeit);
}
}
void rechtsschieben(int anzahl)
{
for(int i = 0; i < anzahl; i++) {
lb = lb >> 1;
wait_ms(zeit);
}
}