Prüfung 9.06.2016

Dependencies:   mbed

Fork of 3BHEL_LDR1 by BULME_BHEL18

main.cpp

Committer:
PosztosAlex
Date:
2016-01-21
Revision:
0:4a51d86e4cbd
Child:
1:987bbbdbcedf

File content as of revision 0:4a51d86e4cbd:

#include "mbed.h"

AnalogIn LDR(p16);

BusOut myled(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);

Serial pc(USBTX,USBRX);

int main() {
    while(1) {
       // myled=LDR.read_u16()/64;
       pc.printf("\r%u %f\n", (LDR.read_u16()/62), LDR.read());
       wait(0.1); 
       
       int licht= LDR.read_u16()/64;    
       
       myled = 0;
       for(int i = 0 ;i < licht / 75; i++ )
        {   
            myled = 0b1<<i | myled ; 
        }
    }
}