Dependencies: mbed
Fork of 3BHEL_LDR by
main.cpp@1:987bbbdbcedf, 2016-06-09 (annotated)
- Committer:
- PosztosAlex
- Date:
- Thu Jun 09 14:27:31 2016 +0000
- Revision:
- 1:987bbbdbcedf
- Parent:
- 0:4a51d86e4cbd
Pr?fung 9.06.2016
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
PosztosAlex | 0:4a51d86e4cbd | 1 | #include "mbed.h" |
PosztosAlex | 0:4a51d86e4cbd | 2 | |
PosztosAlex | 1:987bbbdbcedf | 3 | AnalogIn POTI(p15); |
PosztosAlex | 0:4a51d86e4cbd | 4 | BusOut myled(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1); |
PosztosAlex | 0:4a51d86e4cbd | 5 | |
PosztosAlex | 0:4a51d86e4cbd | 6 | Serial pc(USBTX,USBRX); |
PosztosAlex | 0:4a51d86e4cbd | 7 | |
PosztosAlex | 0:4a51d86e4cbd | 8 | int main() { |
PosztosAlex | 0:4a51d86e4cbd | 9 | while(1) { |
PosztosAlex | 1:987bbbdbcedf | 10 | |
PosztosAlex | 1:987bbbdbcedf | 11 | pc.printf(" %f\n", POTI.read()); |
PosztosAlex | 0:4a51d86e4cbd | 12 | |
PosztosAlex | 1:987bbbdbcedf | 13 | |
PosztosAlex | 1:987bbbdbcedf | 14 | int poti= POTI.read() *10; |
PosztosAlex | 0:4a51d86e4cbd | 15 | |
PosztosAlex | 0:4a51d86e4cbd | 16 | myled = 0; |
PosztosAlex | 1:987bbbdbcedf | 17 | for(int i = 0 ;i < poti ; i++ ) |
PosztosAlex | 0:4a51d86e4cbd | 18 | { |
PosztosAlex | 1:987bbbdbcedf | 19 | myled = 0b1<<i ; |
PosztosAlex | 1:987bbbdbcedf | 20 | } |
PosztosAlex | 1:987bbbdbcedf | 21 | wait_ms(10); |
PosztosAlex | 0:4a51d86e4cbd | 22 | } |
PosztosAlex | 0:4a51d86e4cbd | 23 | } |