main lauflicht test

Dependencies:   mbed

Committer:
rob117
Date:
Mon Jan 13 17:31:32 2020 +0000
Revision:
4:8d806106dbb0
Parent:
3:f82a2b7fb723
Child:
5:c2a8fd8dede5
2 funktion

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rob117 0:696d6bf92662 1 #include "mbed.h"
rob117 1:5756521122a8 2 #define BUTTON1 p14
rob117 0:696d6bf92662 3
rob117 0:696d6bf92662 4
rob117 2:54c01dcbfbc8 5 void nibbleLeds(int value);
rob117 4:8d806106dbb0 6 void printb(uint8_t x);
rob117 3:f82a2b7fb723 7
rob117 0:696d6bf92662 8 BusOut myleds(LED1, LED2, LED3, LED4);
rob117 0:696d6bf92662 9 DigitalIn button(BUTTON1);
rob117 0:696d6bf92662 10
rob117 2:54c01dcbfbc8 11
rob117 2:54c01dcbfbc8 12
rob117 2:54c01dcbfbc8 13
rob117 2:54c01dcbfbc8 14
rob117 0:696d6bf92662 15 const int INIT = 0x03;
rob117 0:696d6bf92662 16
rob117 0:696d6bf92662 17 int main() {
rob117 3:f82a2b7fb723 18 int anzahl, anz;
rob117 3:f82a2b7fb723 19 uint8_t value = INIT;
rob117 3:f82a2b7fb723 20
rob117 3:f82a2b7fb723 21 nibbleLeds(value);
rob117 4:8d806106dbb0 22 printb(value);
rob117 3:f82a2b7fb723 23 wait(0.1);
rob117 0:696d6bf92662 24
rob117 0:696d6bf92662 25
rob117 2:54c01dcbfbc8 26 }
rob117 1:5756521122a8 27
rob117 2:54c01dcbfbc8 28 void nibbleLeds(int value){
rob117 2:54c01dcbfbc8 29 myleds = value%16;
rob117 2:54c01dcbfbc8 30 }
rob117 2:54c01dcbfbc8 31
rob117 4:8d806106dbb0 32 void printb(uint8_t x){
rob117 4:8d806106dbb0 33 for(int i=sizeof(x)<<3; i; i--)
rob117 4:8d806106dbb0 34 putchar('0'+((x>>(i-1))&1));
rob117 4:8d806106dbb0 35 printf("\n");
rob117 4:8d806106dbb0 36
rob117 4:8d806106dbb0 37
rob117 4:8d806106dbb0 38 }