not yet completed

Dependencies:   FatFileSystem MSCFileSystem TextLCD mbed

Fork of TextLCD_HelloWorld by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
safuanCMS
Date:
Wed Aug 17 11:48:03 2016 +0000
Parent:
3:8228ff1c1999
Commit message:
IMDC2016 DPV

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 8228ff1c1999 -r eda6dbfa1d1c main.cpp
--- a/main.cpp	Wed May 04 06:34:59 2016 +0000
+++ b/main.cpp	Wed Aug 17 11:48:03 2016 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "TextLCD.h"
 #include "string"
-#include "MSCFileSystem.h"
+//#include "MSCFileSystem.h"
 
 TextLCD lcd(p15, p16, p10, p11, p12, p13); // rs, e, d4-d7 ;LCD configuration
 
@@ -13,10 +13,11 @@
 DigitalOut  dout(LED1);                             
 DigitalOut  trig(p5);                                       //
 DigitalOut  trigstop(p6);                                   //
+DigitalOut  trigstart(p7);                                  //
 int pbb;
 
-float mini = 0.4f,maxi = 1.2f,stepsize = 0.005f,highV=0,highC=0;
-float pulsedur=0.5,step,sample,width=0.2,current,pulseamplitude=0.1;
+float mini = 0.1f,maxi = 1.2f,stepsize = 0.005f,highV=0,highC=0,readd;
+float pulsedur=0.5,step,sample,width=0.25,current,pulseamplitude=0.1;
 
 void lcdprintnum(float number);
 
@@ -40,17 +41,42 @@
             lcd.locate(0,0);  
             lcd.printf("ScanRate:0.01V/s ");
                 
+                
             for(float i = (mini/3.3); i < (maxi/3.3); i += (stepsize/3.3f)) {
-                aout=(i - (pulseamplitude/3.3));                            //base voltage
+                aout=(i - (pulseamplitude/3.3));    
+                trigstart=1;
+                trigstart=0;
+                trig=0; 
                 wait(pulsedur-width);                                      //base voltage duration, sample 1 here
-                aout=i;                                                    //pulse voltage 
+                
+                if(i>=1.19/3.3){
+                    trigstop=1;        
+                } 
+                
+                aout=i;                                           //pulse voltage 
                 lcd.locate(0,1); 
                 lcdprintnum(aout.read()*3.3);
                 lcd.printf(" V");
-                wait(width);                                             //high pulse duration ; pulse = i
+                trigstart=1;
+                trigstart=0;
+                trig=1;
+                wait(width);     
+                
+           //     readd=3.3f*aout.read();
+                
+            //    if(readd>highC){
+            //        highC=readd;          
+            //    }
+                          
+                
+                                              //high pulse duration ; pulse = i
             }
             aout=0;  
             lcd.cls();   
+            lcdprintnum(readd);
+            
+            wait(2);
+            
         }
     }
 }