This is the initial commit for the voltmeter used in Lab 2.

Dependencies:   SLCD mbed-src

Fork of FRDM-KL46Z LCD rtc Demo by Paul Staron

Files at this revision

API Documentation at this revision

Comitter:
ziadeldebri
Date:
Fri Sep 30 03:52:24 2016 +0000
Parent:
2:eb8f263cccdb
Commit message:
Simpler to explain.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r eb8f263cccdb -r b3b886fc6cf3 main.cpp
--- a/main.cpp	Sun Aug 28 21:10:00 2016 +0000
+++ b/main.cpp	Fri Sep 30 03:52:24 2016 +0000
@@ -30,22 +30,19 @@
 
 SLCD slcd;                          //Setup the LCD on the FRDM-KL46Z.
 DigitalOut  led1(LED1);             //Setup the green LED.
+AnalogIn    ReadVoltage(A0);        //Setup the analog input.
 
-AnalogIn    ReadVoltage(A0);        //Setup the analog input.
-DigitalIn   SwitchSW1(PTC3);        //Setup the digital input, connected to SW1.
-DigitalIn   AnalogInputPin(PTB0);   //Setup a digital input on the same pin as the analog input.
 
 main()
 {
-    AnalogInputPin.mode(PullUp);    //Add a pull resistor to the analog pin (this can be PullUp, PullDown, PullNone, OpenDrain)
-    SwitchSW1.mode(PullUp);         //Add a pull up resistor to SW1.
+   
+            //Add a pull up resistor to SW1.
     led1 = 0;                       //Turn on the green LED.
     slcd.DP1(1);                    //Turn on the decimal point
 
     while(1) {
         led1=!led1;                     //Toggle the green LED
-        //slcd.printf("%4.0f", SwitchSW1.read()*3300.f);  //Use this line to read SW1
         slcd.printf("%4.0f", ReadVoltage.read()*3300.f);  //Use this line to read the analog input.
-        wait(.1f);                  //Wait .1 seconds.
+        wait(2);                  //Wait 2 seconds.
     }
 }