Initial demo code

Dependencies:   mbed ssd1331

Files at this revision

API Documentation at this revision

Comitter:
star297
Date:
Mon May 23 16:54:44 2016 +0000
Commit message:
Oled 96x64 Demo

Changed in this revision

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
ssd1331.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r eb819dd71954 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 23 16:54:44 2016 +0000
@@ -0,0 +1,121 @@
+#include "mbed.h"
+#include "ssd1331.h"
+
+ssd1331 oled(D8, D7, D10, D11, NC, D13); // cs, res, dc, miso, (nc), sck   
+
+
+char Time[50],Date[50];
+void gettime();
+
+int main() {    
+
+
+    while(1){
+        
+        oled.Fill_Screen(oled.toRGB(255,0,0)); //red
+     //   oled.dim();
+        wait_ms(500);
+        oled.Fill_Screen(oled.toRGB(0,255,0)); //full green color in OLED 
+    //    oled.dim();
+        wait_ms(500);
+        oled.Fill_Screen(oled.toRGB(0,0,255)); //full blue color in OLED 
+        wait_ms(500);
+        oled.Fill_Screen(oled.toRGB(255,255,255)); //full blue color in OLED 
+        wait_ms(500);
+        
+        oled.cls();
+ 
+        oled.circle (20, 40, 30 ,oled.toRGB(0,0,255) , 1);
+        oled.circle (20, 40, 30 ,oled.toRGB(255,255,255) , 0); 
+        oled.circle (20, 60, 40 ,oled.toRGB(255,0,0) , 0); 
+        oled.line( 0, 0, width, height, oled.toRGB(0,255,255)); 
+        oled.line( width, 0, 0, height, oled.toRGB(255,0,255)); 
+        oled.rect(10,10,90,60,oled.toRGB(255,255,0));
+        oled.fillrect(20,20,40,40,oled.toRGB(255,255,255),oled.toRGB(0,255,0));
+        
+        for(int y = 9; y >= 0; y--) {
+             oled.contrast(y);
+             oled.foreground(oled.toRGB(255,255,255));
+             oled.locate(1, 10);
+             oled.printf("%d",y);
+             wait_ms(300);
+        }  
+        
+        wait_ms(1000);
+        oled.contrast(9);
+        wait_ms(2000);
+        oled.cls();
+
+        oled.SetFontSize(HIGH);
+        oled.foreground(oled.toRGB(0,255,0));
+        oled.locate(0, 10);
+        oled.printf( "HIGH 12345");  
+        
+        oled.SetFontSize(WIDE);
+        oled.foreground(oled.toRGB(0,0,255));
+        oled.locate(0, 28);
+        oled.printf( "WIDE 123");  
+        
+        oled.SetFontSize(WH);
+        oled.foreground(oled.toRGB(255,0,0));
+        oled.locate(0, 40);
+        oled.printf( "WH 123");
+        
+        oled.SetFontSize(NORMAL);
+        oled.foreground(oled.toRGB(255,255,255));      
+                
+        oled.ScrollSet(0,8,18,1,0);
+        oled.Scrollstart();
+       
+        gettime();
+        wait(1);
+        gettime();
+        wait(1);
+        gettime();
+        wait(1);
+      
+        oled.ScrollSet(0,8,18,-2,0);
+       // oled.Scrollstart();
+       
+        gettime();
+        wait(1);
+        gettime();
+        wait(1);
+        gettime();
+        wait(1);
+        
+        oled.ScrollSet(0,8,18,3,0);
+     //   oled.Scrollstart();
+        
+        gettime();
+        wait(1);
+        gettime();
+        wait(1);
+        gettime();
+        wait(1);
+        
+        oled.ScrollSet(0,8,18,-4,0);
+    //    oled.Scrollstart();
+       
+        gettime();
+        wait(1);
+        gettime();
+        wait(1);
+        gettime();
+        wait(1);
+        
+        oled.Scrollstop();
+        wait(1);
+         
+       // while(1);
+     }               
+}
+void gettime()
+{    
+    time_t seconds = time(NULL);
+    strftime(Time,40,"%H:%M:%S %a", localtime(&seconds));
+    strftime(Date,40,"%d-%b-%Y", localtime(&seconds));
+    oled.locate(0, 0);
+    oled.printf(Time); 
+}
+
diff -r 000000000000 -r eb819dd71954 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 23 16:54:44 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file
diff -r 000000000000 -r eb819dd71954 ssd1331.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ssd1331.lib	Mon May 23 16:54:44 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/star297/code/ssd1331/#062b4708eb35