Luca Jel
/
mbed5a_testy
sdsd
Fork of mbed5a_testy by
led.cpp
- Committer:
- Robsonik16
- Date:
- 2017-05-05
- Revision:
- 1:b8d65b5745d1
File content as of revision 1:b8d65b5745d1:
#include "led.h" #include "mbed.h" DigitalOut led_0(PA_4); DigitalOut led_1(PA_5); DigitalOut led_2(PA_6); DigitalOut led_3(PA_7); enum Step{LEFT, RIGHT}; void LedInt(void){ //IO1DIR=IO1DIR|(LED0_bm|LED1_bm|LED2_bm|LED3_bm); //IO1SET= LED0_bm; } void LedOn(unsigned char ucLedIndeks){ //IO1CLR = LED0_bm|LED1_bm|LED2_bm|LED3_bm; led_0=0; led_1=0; led_2=0; led_3=0; switch (ucLedIndeks) { case 0: led_0=1; break; case 1: led_1=1; break; case 2: led_2=1; break; case 3: led_3=1; break; default: break; } } void Led_Step(enum Step Direction){ static unsigned int uiDioda; if (Direction == RIGHT ){ uiDioda++; }else{ uiDioda--; } LedOn(uiDioda%4); } void Led_StepLeft(void){ Led_Step(LEFT); } void Led_StepRight(void){ Led_Step(RIGHT); }