This is an incomplete project for an in-class activity with a seven segment display.

Dependencies:   SLCD mbed-src

Files at this revision

API Documentation at this revision

Comitter:
mattshuman
Date:
Tue Oct 18 22:49:24 2016 +0000
Parent:
0:810603b26492
Commit message:
fixed demo

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 810603b26492 -r fcc37968658c main.cpp
--- a/main.cpp	Tue Oct 18 16:36:06 2016 +0000
+++ b/main.cpp	Tue Oct 18 22:49:24 2016 +0000
@@ -31,7 +31,8 @@
 SLCD slcd;                          //Setup the LCD on the FRDM-KL46Z.
 DigitalOut  led1(LED1);             //Setup the green LED.
 AnalogIn    ReadVoltage(A0);        //Setup the analog input.
-BusOut display(PTE31, PTE19, PTE18, PTE17, PTE16, PTE6, PTE3);
+BusOut display(PTE31, PTE19, PTE18, PTE17, PTE16, PTE6, PTE3, PTE2);
+//This creates an array of ports with PTE2 is the MSB and PTE31 is the LSB.
 
 main()
 {
@@ -42,15 +43,21 @@
 
     while(1) {
         led1=!led1;                     //Toggle the green LED
-        for(int i=0; i<4 ; i++){
+        for(int i=0; i<16 ; i++){
             slcd.printf("   %i",i);  //Use this line to read the analog input.
             switch(i){
-                case 0: display = 0x3F;break;
-                case 1: display = 0x06;break;
-                case 2: display = 0x5B;break;
+                case 0: display = 0x01;break; //also 0x01 //.abcedfg
+                case 1: display = 0xCF;break;
+                case 2: display = 0x92;break;
                 case 3: display = 0x4F;break;
+                case 4: display = 0x66;break;
+                case 5: display = 0xA8;break;
+                case 6: display = 0x40;break;
+                case 7: display = 0x0F;break;
+                case 8: display = 0x80;break;
+                case 9: display = 0x77;break;
             }//end of switch
-            wait(1);
+            wait(2);
         }//end of for
     }//end of while
 }//end of main