![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
0720_Lab2_2
Dependencies: mbed
main.cpp@0:4a342e147b61, 2015-10-13 (annotated)
- Committer:
- chinetion
- Date:
- Tue Oct 13 07:41:50 2015 +0000
- Revision:
- 0:4a342e147b61
111;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chinetion | 0:4a342e147b61 | 1 | #include "mbed.h" |
chinetion | 0:4a342e147b61 | 2 | |
chinetion | 0:4a342e147b61 | 3 | AnalogIn analog(A0); |
chinetion | 0:4a342e147b61 | 4 | DigitalOut p(D8); |
chinetion | 0:4a342e147b61 | 5 | BusOut myleds1(D2,D3); |
chinetion | 0:4a342e147b61 | 6 | BusOut myleds2(D4,D5,D6,D7); |
chinetion | 0:4a342e147b61 | 7 | int main() { |
chinetion | 0:4a342e147b61 | 8 | while(1){ |
chinetion | 0:4a342e147b61 | 9 | float a = analog.read(); |
chinetion | 0:4a342e147b61 | 10 | int b = a*33; |
chinetion | 0:4a342e147b61 | 11 | int led1=b/10; |
chinetion | 0:4a342e147b61 | 12 | int led2=b%10; |
chinetion | 0:4a342e147b61 | 13 | myleds1=led1; |
chinetion | 0:4a342e147b61 | 14 | myleds2=led2; |
chinetion | 0:4a342e147b61 | 15 | p=1; |
chinetion | 0:4a342e147b61 | 16 | } |
chinetion | 0:4a342e147b61 | 17 | } |
chinetion | 0:4a342e147b61 | 18 |