Isme bina HysterisisIn use kiye lab 18 ka output nikalte h. Program Ft. Chirayu Mahadeshwar

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
akashlal
Date:
Thu Jul 07 08:22:11 2016 +0000
Parent:
0:060c8e380e75
Commit message:
na

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 060c8e380e75 -r c2e1412f8efe main.cpp
--- a/main.cpp	Fri Jul 01 09:29:45 2016 +0000
+++ b/main.cpp	Thu Jul 07 08:22:11 2016 +0000
@@ -3,16 +3,25 @@
 //Hysterisis thresholds are 0.2 and 0.4
 AnalogIn ldr(PTB1);
 DigitalOut led(PTD1);
+Serial pc(USBTX,USBRX);
 
 int main() {
     float i;
+    int ldrval, ledval;
     while(1) {
+        ldrval=ldr.read()*1000;
         i=ldr.read();
         if(i>=0.4)
+        {
         led=0;
-       if(i<=0.2)
-      led=1;
-        
+        ledval=1000;
+        }
+        if(i<=0.2)
+        {
+        led=1;
+        ledval=10;
+        }
+        pc.printf("$%d %d;",ldrval,ledval);
      }
 }