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.
main.cpp@0:a8782cd1474e, 2018-05-17 (annotated)
- Committer:
- syahirammar
- Date:
- Thu May 17 07:08:06 2018 +0000
- Revision:
- 0:a8782cd1474e
ADC Syahir
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| syahirammar | 0:a8782cd1474e | 1 | #include "mbed.h" |
| syahirammar | 0:a8782cd1474e | 2 | #include "TextLCD.h" |
| syahirammar | 0:a8782cd1474e | 3 | |
| syahirammar | 0:a8782cd1474e | 4 | TextLCD lcd(D8, D9, D4, D5, D6, D7); |
| syahirammar | 0:a8782cd1474e | 5 | Serial pc(USBTX, USBRX); |
| syahirammar | 0:a8782cd1474e | 6 | AnalogIn Ain(PC_3); |
| syahirammar | 0:a8782cd1474e | 7 | float ADCdata; |
| syahirammar | 0:a8782cd1474e | 8 | |
| syahirammar | 0:a8782cd1474e | 9 | int main() { |
| syahirammar | 0:a8782cd1474e | 10 | lcd.printf("LDR ="); |
| syahirammar | 0:a8782cd1474e | 11 | while (1) |
| syahirammar | 0:a8782cd1474e | 12 | { |
| syahirammar | 0:a8782cd1474e | 13 | ADCdata=Ain; |
| syahirammar | 0:a8782cd1474e | 14 | ADCdata=ADCdata*100; |
| syahirammar | 0:a8782cd1474e | 15 | lcd.locate (4,1); |
| syahirammar | 0:a8782cd1474e | 16 | lcd.printf("%f",ADCdata); |
| syahirammar | 0:a8782cd1474e | 17 | pc.printf("%f \n\r",ADCdata); |
| syahirammar | 0:a8782cd1474e | 18 | wait (0.5); |
| syahirammar | 0:a8782cd1474e | 19 | } |
| syahirammar | 0:a8782cd1474e | 20 | } |