C++ project
Dependencies: SeeedGrayOLED mbed
Fork of MBED_CPP_DII4A by
main.cpp@5:65e3a465f9b1, 2017-03-14 (annotated)
- Committer:
- mr_cub3
- Date:
- Tue Mar 14 13:23:41 2017 +0000
- Revision:
- 5:65e3a465f9b1
- Parent:
- 4:c2db59ea2838
blabla
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mr_cub3 | 4:c2db59ea2838 | 1 | /* |
mr_cub3 | 4:c2db59ea2838 | 2 | * Copyright (c) 2012 Neal Horman - http://www.wanlink.com |
mr_cub3 | 4:c2db59ea2838 | 3 | * |
mr_cub3 | 4:c2db59ea2838 | 4 | * License: MIT open source (http://opensource.org/licenses/MIT) |
mr_cub3 | 4:c2db59ea2838 | 5 | * Summary; |
mr_cub3 | 4:c2db59ea2838 | 6 | * Use / modify / distribute / publish it how you want and |
mr_cub3 | 4:c2db59ea2838 | 7 | * if you use it, or don't, you can't hold me liable for how |
mr_cub3 | 4:c2db59ea2838 | 8 | * it does or doesn't work. |
mr_cub3 | 4:c2db59ea2838 | 9 | * If it doesn't work how you want, don't use it, or change |
mr_cub3 | 4:c2db59ea2838 | 10 | * it so that it does work. |
mr_cub3 | 4:c2db59ea2838 | 11 | */ |
mr_cub3 | 0:cc27e545a4de | 12 | |
mr_cub3 | 4:c2db59ea2838 | 13 | #include "mbed.h" |
mr_cub3 | 4:c2db59ea2838 | 14 | #include "SeeedGrayOLED.h" |
mr_cub3 | 4:c2db59ea2838 | 15 | |
mr_cub3 | 4:c2db59ea2838 | 16 | DigitalOut myLed(LED1); |
mr_cub3 | 4:c2db59ea2838 | 17 | DigitalIn greenPB(p20); |
mr_cub3 | 4:c2db59ea2838 | 18 | SeeedGrayOLED SeeedGrayOled(p9, p10); |
mr_cub3 | 0:cc27e545a4de | 19 | |
mr_cub3 | 4:c2db59ea2838 | 20 | int main() |
mr_cub3 | 4:c2db59ea2838 | 21 | { |
mr_cub3 | 4:c2db59ea2838 | 22 | greenPB.mode(PullUp); |
mr_cub3 | 4:c2db59ea2838 | 23 | while(1) |
mr_cub3 | 4:c2db59ea2838 | 24 | { |
mr_cub3 | 4:c2db59ea2838 | 25 | if(!greenPB) |
mr_cub3 | 4:c2db59ea2838 | 26 | { |
mr_cub3 | 4:c2db59ea2838 | 27 | SeeedGrayOled.init(); //initialize SEEED OLED display |
mr_cub3 | 4:c2db59ea2838 | 28 | SeeedGrayOled.clearDisplay(); //Clear Display. |
mr_cub3 | 4:c2db59ea2838 | 29 | SeeedGrayOled.setNormalDisplay(); //Set Normal Display Mode |
mr_cub3 | 4:c2db59ea2838 | 30 | SeeedGrayOled.setVerticalMode(); // Set to vertical mode for displaying text |
mr_cub3 | 4:c2db59ea2838 | 31 | SeeedGrayOled.setTextXY(0,0); |
mr_cub3 | 4:c2db59ea2838 | 32 | SeeedGrayOled.setGrayLevel(10); |
mr_cub3 | 5:65e3a465f9b1 | 33 | SeeedGrayOled.putString("Ce message est plutot long ma foi"); |
mr_cub3 | 4:c2db59ea2838 | 34 | //wait_ms(1.0); |
mr_cub3 | 4:c2db59ea2838 | 35 | |
mr_cub3 | 4:c2db59ea2838 | 36 | } |
mr_cub3 | 4:c2db59ea2838 | 37 | |
mr_cub3 | 4:c2db59ea2838 | 38 | //for(char i=1; i < 11 ; i++) { |
mr_cub3 | 4:c2db59ea2838 | 39 | // SeeedGrayOled.setTextXY(i,0); //set Cursor to first line, 0th column |
mr_cub3 | 4:c2db59ea2838 | 40 | // SeeedGrayOled.setGrayLevel(i); //Set Grayscale level. Any number between 0 - 15. |
mr_cub3 | 5:65e3a465f9b1 | 41 | // SeeedGrayOled.putString("yep"); //Print whatever you want |
mr_cub3 | 4:c2db59ea2838 | 42 | // wait_ms(1.0); |
mr_cub3 | 4:c2db59ea2838 | 43 | //} |
mr_cub3 | 4:c2db59ea2838 | 44 | |
mr_cub3 | 4:c2db59ea2838 | 45 | wait_ms(5.0); |
mr_cub3 | 0:cc27e545a4de | 46 | } |
mr_cub3 | 4:c2db59ea2838 | 47 | |
mr_cub3 | 4:c2db59ea2838 | 48 | } |