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@0:709cf4309909, 2016-07-01 (annotated)
- Committer:
- akashlal
- Date:
- Fri Jul 01 09:21:15 2016 +0000
- Revision:
- 0:709cf4309909
- Child:
- 1:3151bf0df238
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 | 0:709cf4309909 | 7 | float potf; //Declaring float value for Potentiometer reading |
akashlal | 0:709cf4309909 | 8 | int poti; //Declaring int value for Potentiometer reading |
akashlal | 0:709cf4309909 | 9 | float ldrf; //Declaring float value for LDR reading |
akashlal | 0:709cf4309909 | 10 | int ldri; //Declaring Integer value for LDR reading |
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 | 0:709cf4309909 | 20 | pc.printf("$%d %d;",poti,ldri); //Printing value of LDR and Pot Float value. |
akashlal | 0:709cf4309909 | 21 | pc.printf("\n \r"); |
akashlal | 0:709cf4309909 | 22 | } |
akashlal | 0:709cf4309909 | 23 | } |