Robert Buch / Mbed 2 deprecated compile

Dependencies:   mbed

Committer:
robertbuc
Date:
Mon Jan 13 17:30:18 2020 +0000
Revision:
2:db4c700f1898
Parent:
1:06d6570e52bc
Child:
3:380bc168e247
nibbleled und printb

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robertbuc 0:136627249b57 1 /*
robertbuc 0:136627249b57 2 weitere viele Beispiele in meinem WIKI
robertbuc 1:06d6570e52bc 3
robertbuc 1:06d6570e52bc 4 */
robertbuc 2:db4c700f1898 5
robertbuc 1:06d6570e52bc 6 #include "mbed.h"
robertbuc 1:06d6570e52bc 7 //#define BUTTON1 p14
robertbuc 1:06d6570e52bc 8 //#define BUTTON1 A1
robertbuc 0:136627249b57 9
robertbuc 0:136627249b57 10
robertbuc 1:06d6570e52bc 11 void nibbleLeds(int value);
robertbuc 2:db4c700f1898 12 void printb(uint8_t x);
robertbuc 0:136627249b57 13
robertbuc 1:06d6570e52bc 14 BusOut myleds(LED1,LED2,LED3,LED4);
robertbuc 0:136627249b57 15 DigitalIn button(BUTTON1);
robertbuc 0:136627249b57 16
robertbuc 0:136627249b57 17 const int INIT=0x03;
robertbuc 0:136627249b57 18
robertbuc 0:136627249b57 19 int main()
robertbuc 0:136627249b57 20 {
robertbuc 1:06d6570e52bc 21 int anzahl,anz;
robertbuc 1:06d6570e52bc 22 uint8_t value=INIT;
robertbuc 2:db4c700f1898 23
robertbuc 1:06d6570e52bc 24
robertbuc 1:06d6570e52bc 25 nibbleLeds(value);
robertbuc 2:db4c700f1898 26 printb(value);
robertbuc 1:06d6570e52bc 27 wait(0.1);
robertbuc 1:06d6570e52bc 28 }
robertbuc 1:06d6570e52bc 29
robertbuc 2:db4c700f1898 30
robertbuc 2:db4c700f1898 31 void printb(uint8_t x)
robertbuc 1:06d6570e52bc 32 {
robertbuc 2:db4c700f1898 33 for(int i=sizeof(x)<<3;i;i--)
robertbuc 2:db4c700f1898 34 putchar('0'+((x>>(i-1))&1));
robertbuc 2:db4c700f1898 35 printf("\n");
robertbuc 2:db4c700f1898 36 }