Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:63e28be79637, committed 2015-08-03
- Comitter:
- youhinclark
- Date:
- Mon Aug 03 10:35:21 2015 +0000
- Parent:
- 0:d86587ed9b1c
- Commit message:
- Touch
Changed in this revision
| Analog_in_iia.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d86587ed9b1c -r 63e28be79637 Analog_in_iia.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Analog_in_iia.lib Mon Aug 03 10:35:21 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/hasimo/code/Analog_in_iia/#d86587ed9b1c
diff -r d86587ed9b1c -r 63e28be79637 main.cpp
--- a/main.cpp Mon Jul 28 04:49:01 2014 +0000
+++ b/main.cpp Mon Aug 03 10:35:21 2015 +0000
@@ -3,13 +3,26 @@
TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7
AnalogIn ain(p15);
-
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
int main() {
- float adc;
+ float abc=0;
while (1){
+ abc=ain.read();
lcd.locate(0,0);
- lcd.printf("%8.3f \n", ain.read());
+ abc*=10;
+ lcd.printf("%8.3f cm\n", abc);
+ if((int)(abc)%4==0) myled1=1;
+ else myled1=0;
+ if((int)(abc)%4==1) myled2=1;
+ else myled2=0;
+ if((int)(abc)%4==2) myled3=1;
+ else myled3=0;
+ if((int)(abc)%4==3) myled4=1;
+ else myled4=0;
wait(0.05); // 20Hz update rate
}
}
\ No newline at end of file