Code for testing the ELEC1620 Application Board.

Dependencies:   N5110 ShiftReg Tone mbed

Files at this revision

API Documentation at this revision

Comitter:
eencae
Date:
Wed Nov 01 20:54:21 2017 +0000
Parent:
0:fabfe08aee13
Commit message:
Updated N5110 library to be able to test LCD contrast using potentiometer.

Changed in this revision

Main/main.cpp Show annotated file Show diff for this revision Revisions of this file
N5110.lib Show annotated file Show diff for this revision Revisions of this file
diff -r fabfe08aee13 -r 9359b8534c79 Main/main.cpp
--- a/Main/main.cpp	Wed Nov 01 09:44:56 2017 +0000
+++ b/Main/main.cpp	Wed Nov 01 20:54:21 2017 +0000
@@ -48,7 +48,7 @@
     test_7seg();
     leds = 0x0F;  // on-board LEDs
     speaker.play(1000.0,2.0);
-
+        
     // loop forever
     while(1) {
 
@@ -129,8 +129,8 @@
 void test_ldr()
 {
     float value = ldr.read();  // read in the LDR value in range 0.0 to 1.0
-    char buffer[14];  
-    
+    char buffer[14];
+
     sprintf(buffer,"LDR=%.2f",value); // print formatted data to buffer
     lcd.printString(buffer,0,2);           // display on screen
 }
@@ -139,24 +139,26 @@
 {
     float value = 3.3*tmp36.read();  // read in the TMP36 value in range 0.0 to 1.0
     float temperature = 100.0f*value - 50.0f;
-    char buffer[14];  
-    
+    char buffer[14];
+
     sprintf(buffer,"T=%.4f C",temperature); // print formatted data to buffer
     lcd.printString(buffer,0,3);           // display on screen
 }
 
-void test_pots() {
-    
-    char buffer[14];  
+void test_pots()
+{
+
+    char buffer[14];
 
     float val = pot_0.read();
     sprintf(buffer,"%.2f",val); // print formatted data to buffer
     lcd.printString(buffer,0,5);           // display on screen
+    lcd.setContrast(val);  // tune LCD contrast 
 
     val = pot_1.read();
     sprintf(buffer,"%.2f",val); // print formatted data to buffer
     lcd.printString(buffer,28,5);           // display on screen
-    
+
     val = pot_2.read();
     sprintf(buffer,"%.2f",val); // print formatted data to buffer
     lcd.printString(buffer,56,5);           // display on screen
diff -r fabfe08aee13 -r 9359b8534c79 N5110.lib
--- a/N5110.lib	Wed Nov 01 09:44:56 2017 +0000
+++ b/N5110.lib	Wed Nov 01 20:54:21 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/eencae/code/N5110/#6c046786be6c
+http://mbed.org/users/eencae/code/N5110/#57f9d32fb521