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:
- martwerl
- Date:
- 2018-11-15
- Revision:
- 0:62452b8daf37
File content as of revision 0:62452b8daf37:
#include "mbed.h"
//DigitalOut myled(LED1);
// DigitalOut eine Variable für ein Bit
// BusOut eine Variable für eine ganze Bitgruppe
// Alle 12-Leds des M0-Boards zu einer Bitgruppe zusammenfassen
// LSB MSB
// 2^0 2^1 2^2 2^11
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 D17 D16 D15 D14 D13 D4 D3 D2 D1
//void LedBarTest();
void Runlight1();
void Runlight2();
void Runlight3();
int main()
{
lb = 0;
while (1)
{
Runlight3();
//LedBarTest();
}
}
void Runlight1()
{
lb = 1;
for(int i = 0;i <= 12; i++)
{
wait_ms(100);
lb = lb << 1;//nach links verschieben
}
}
void Runlight2()//Lauflicht mit 1en nachschieben
{
lb = 1;
for(int i = 0;i <= 12; i++)
{
wait_ms(100);
lb = (lb << 1) | 1;//nach links verschieben und einen einser dazuverodern
}
lb = 1;
for(int i = 0;i <= 12; i++)
{
wait_ms(100);
lb = (lb << 1);//
}
}
void Runlight3()//3er Gruppe aufbauen und weiterschieben
{
lb = 1;
for(int i = 0;i <= 12; i++)
{
wait_ms(100);
lb = (lb << 1) | 1;//nach links verschieben und einen einser dazuverodern
}
}
void LedBarTest()
{
lb = 1; //D20 setzen
wait_ms(500);
lb = 2; //D19 setzen
wait_ms(500);
lb = 3; //D19 und D20 setzen
wait_ms(500);
lb = 4; //D18 setzen
wait_ms(500);
lb = 15; //D20...D17 setzen
wait_ms(500);
}