Isme plot hotai LDR aur POT ka value, wrt time serial plotter ke graph me. Baud rate 9600 select karneka aur axes 2 select karna mat bhulna
Dependencies: mbed
main.cpp@1:3151bf0df238, 2016-07-01 (annotated)
- Committer:
- akashlal
- Date:
- Fri Jul 01 09:22:06 2016 +0000
- Revision:
- 1:3151bf0df238
- Parent:
- 0:709cf4309909
na
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashlal | 0:709cf4309909 | 1 | #include "mbed.h" |
akashlal | 0:709cf4309909 | 2 | |
akashlal | 0:709cf4309909 | 3 | Serial pc(USBTX,USBRX); |
akashlal | 0:709cf4309909 | 4 | AnalogIn pot(PTB0); |
akashlal | 0:709cf4309909 | 5 | AnalogIn ldr(PTB1); |
akashlal | 0:709cf4309909 | 6 | //This progeram is to be submitted for report 02 |
akashlal | 1:3151bf0df238 | 7 | float potf; |
akashlal | 1:3151bf0df238 | 8 | int poti; |
akashlal | 1:3151bf0df238 | 9 | float ldrf; |
akashlal | 1:3151bf0df238 | 10 | int ldri; |
akashlal | 0:709cf4309909 | 11 | |
akashlal | 0:709cf4309909 | 12 | int main() |
akashlal | 0:709cf4309909 | 13 | { |
akashlal | 0:709cf4309909 | 14 | while(1) |
akashlal | 0:709cf4309909 | 15 | { |
akashlal | 0:709cf4309909 | 16 | ldrf=ldr.read(); |
akashlal | 0:709cf4309909 | 17 | ldri=ldrf*1000; |
akashlal | 0:709cf4309909 | 18 | potf=pot.read(); |
akashlal | 0:709cf4309909 | 19 | poti=potf*1000; |
akashlal | 1:3151bf0df238 | 20 | pc.printf("$%d %d;",poti,ldri); |
akashlal | 0:709cf4309909 | 21 | pc.printf("\n \r"); |
akashlal | 0:709cf4309909 | 22 | } |
akashlal | 0:709cf4309909 | 23 | } |