Riad_ Bajraktarevic
/
BinHexDezVergl
3. Aufgaben _ Bitmanipulationen Grundlegend
Diff: main.cpp
- Revision:
- 2:84519c8101cb
- Parent:
- 1:af76e894b90f
--- a/main.cpp Sat Jan 11 12:04:47 2020 +0000 +++ b/main.cpp Sat Jan 11 12:05:08 2020 +0000 @@ -8,3 +8,18 @@ uint8_t pos = 0; uint8_t shift = 3; +int main() { + while (1) { + pos = (1 << shift); // shift left + printf("%x\n", pos); + if(pos == 0x08) + led4 = !led4; + if(pos == 0x04) + led3 = !led3; + if(pos == 0x02) + led2 = !led2; + if(pos == 0x01) + led1 = !led1; + wait_ms(500); + } +} \ No newline at end of file