display i2c
Dependencies: mbed SSD1308_128x64_I2C USBDevice
Diff: main.cpp
- Revision:
- 2:d86478c0f5da
- Parent:
- 1:00053cb70ac5
- Child:
- 3:1337e3d65ed0
diff -r 00053cb70ac5 -r d86478c0f5da main.cpp --- a/main.cpp Sat Jun 30 14:44:39 2012 +0000 +++ b/main.cpp Mon Jul 09 20:46:27 2012 +0000 @@ -46,9 +46,10 @@ pc.printf("7: Display Invert\n\r"); pc.printf("8: Display Normal\n\r"); pc.printf("9: Display Bitmap\n\r"); -// pc.printf("A: \n\r"); -// pc.printf("B: \n\r"); -// pc.printf("C: \n\r"); + pc.printf("A: Brightness Ramp\n\r"); + pc.printf("B: Send Inverted Message\n\r"); + pc.printf("C: Flip and Mirror\n\r"); + // pc.printf("D: \n\r"); // pc.printf("E: \n\r"); // pc.printf("F: \n\r"); @@ -133,6 +134,9 @@ int main() { bool running=true; + bool left = true; + bool down = true; + char command; init_interfaces(); @@ -181,7 +185,7 @@ break; case '3' : - pc.printf("Fill Display 0xA5\n\r"); + pc.printf("Fill Display 0xAA\n\r"); oled.fillDisplay(0xA5); break; @@ -216,12 +220,33 @@ break; case 'A' : - + pc.printf("Brightness Ramp Down\r\n"); + for (int contrast=0x7F; contrast >= 0x00; contrast--) { + oled.setContrastControl(contrast); + wait(0.05); + } + + wait(1); + + pc.printf("Brightness Ramp Up\r\n"); + for (int contrast=0x00; contrast <= 0x7F; contrast++) { + oled.setContrastControl(contrast); + wait(0.05); + } + break; case 'B' : - - break; + pc.printf("Send Inverted Message\n\r"); + oled.writeString(0, 0, 13, "Hello World !", true); + break; + + case 'C' : + pc.printf("Flip and Mirror (Rewrite display to show horizontal effect)\n\r"); + left = !left; + down = !down; + oled.setDisplayFlip(left, down); + break; } //switch }//if