Lab 2 code for the kl43z

Dependencies:   SLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
Dogcatfee
Date:
Fri Sep 22 02:30:52 2017 +0000
Commit message:
Add code

Changed in this revision

SLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r e29d58224e1d SLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SLCD.lib	Fri Sep 22 02:30:52 2017 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/Dogcatfee/code/SLCD/#ca792cac7591
diff -r 000000000000 -r e29d58224e1d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 22 02:30:52 2017 +0000
@@ -0,0 +1,48 @@
+/*! Lab2
+ *  Used to turn the FRDM-KL46Z into a voltmeter.
+ *  Modified from: https://developer.mbed.org/users/star297/code/FRDM-KL46Z-LCD-rtc-Demo/
+ * \author  Matthew Shuman
+ *
+ * \date    August 28th, 2016
+
+ * \bug     No bugs yet
+
+ * @code
+ * #include "mbed.h"
+ * #include "SLCD.h"
+
+ * SLCD myLcd;
+ * int myNumber=0;
+ * int main()
+ * {
+ *     while(1) {
+ *        myLcd.printf("00%2.0i",myNumber);
+ *        ++myNumber;
+ *         wait(.1);
+ *     }//end of while
+ * }//end of main
+ * @endcode
+ */
+
+
+#include "mbed.h"
+#include "SLCD.h"
+
+SLCD slcd;                          //Setup the LCD on the FRDM-KL46Z.
+DigitalOut  led1(LED1);             //Setup the green LED.
+AnalogIn    ReadVoltage(A0);        //Setup the analog input.
+
+
+main()
+{
+   
+            //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", ReadVoltage.read()*3300.f);  //Use this line to read the analog input.
+        wait(2);                  //Wait 2 seconds.
+    }
+}
diff -r 000000000000 -r e29d58224e1d mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Sep 22 02:30:52 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b0220dba8be7
\ No newline at end of file