![](/media/cache/profiles/OS_Headshot_2_SQ_sm.jpg.50x50_q85.jpg)
Test program for driving the GHI Character Display module from the Outrageous Circuits mBuino platform
Dependencies: TextLCD USBDevice mbed
main.cpp@0:271f8cc9758c, 2014-11-25 (annotated)
- Committer:
- devhammer
- Date:
- Tue Nov 25 21:54:23 2014 +0000
- Revision:
- 0:271f8cc9758c
- Child:
- 1:c126b5e56bd0
Initial Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
devhammer | 0:271f8cc9758c | 1 | #include "mbed.h" |
devhammer | 0:271f8cc9758c | 2 | #include "TextLCD.h" |
devhammer | 0:271f8cc9758c | 3 | //#include "USBSerial.h" |
devhammer | 0:271f8cc9758c | 4 | |
devhammer | 0:271f8cc9758c | 5 | //USBSerial pc; |
devhammer | 0:271f8cc9758c | 6 | |
devhammer | 0:271f8cc9758c | 7 | // These pin assignments work for the Outrageous Circuits' mBuino platform |
devhammer | 0:271f8cc9758c | 8 | // http://developer.mbed.org/platforms/Outrageous-Circuits-mBuino/ |
devhammer | 0:271f8cc9758c | 9 | // |
devhammer | 0:271f8cc9758c | 10 | // This code example uses the GHI Character Display module for .NET Gadgeteer: |
devhammer | 0:271f8cc9758c | 11 | // https://www.ghielectronics.com/catalog/product/395 |
devhammer | 0:271f8cc9758c | 12 | // and breaks out the pins via a GHI Extender module, but the code should |
devhammer | 0:271f8cc9758c | 13 | // work with any HD44780-based LCD (socket/pin map at above URL) |
devhammer | 0:271f8cc9758c | 14 | // |
devhammer | 0:271f8cc9758c | 15 | // Code example leverages the TextLCD library for communicating with the |
devhammer | 0:271f8cc9758c | 16 | // Display Module, and is a modified version of the example code from |
devhammer | 0:271f8cc9758c | 17 | // that library. |
devhammer | 0:271f8cc9758c | 18 | // http://developer.mbed.org/users/simon/code/TextLCD/ |
devhammer | 0:271f8cc9758c | 19 | // |
devhammer | 0:271f8cc9758c | 20 | // Note that the 5V supply for the display must be provided externally, as |
devhammer | 0:271f8cc9758c | 21 | // well as power for the backlight pin. |
devhammer | 0:271f8cc9758c | 22 | |
devhammer | 0:271f8cc9758c | 23 | // Uncomment the include for USBSerial.h, the USBSerial declaration, and the |
devhammer | 0:271f8cc9758c | 24 | // pc.printf statements to enable serial debugging over USB. |
devhammer | 0:271f8cc9758c | 25 | |
devhammer | 0:271f8cc9758c | 26 | TextLCD lcd(P0_10, P0_9, P0_15, P0_11, P0_13, P0_18); // rs, e, d4-d7 |
devhammer | 0:271f8cc9758c | 27 | |
devhammer | 0:271f8cc9758c | 28 | int main() { |
devhammer | 0:271f8cc9758c | 29 | //pc.getc(); |
devhammer | 0:271f8cc9758c | 30 | // wait(5); |
devhammer | 0:271f8cc9758c | 31 | // pc.printf("Initializing...\r\n"); |
devhammer | 0:271f8cc9758c | 32 | wait(2); |
devhammer | 0:271f8cc9758c | 33 | |
devhammer | 0:271f8cc9758c | 34 | // pc.printf("Writing Hello, World! to char display...\r\n"); |
devhammer | 0:271f8cc9758c | 35 | lcd.printf("Hello World!\n"); |
devhammer | 0:271f8cc9758c | 36 | // wait(2); |
devhammer | 0:271f8cc9758c | 37 | // pc.printf("Text written to char display...\r\n"); |
devhammer | 0:271f8cc9758c | 38 | |
devhammer | 0:271f8cc9758c | 39 | // pc.printf("Writing mBuino rocks! to char display...\r\n"); |
devhammer | 0:271f8cc9758c | 40 | lcd.printf("mBuino rocks!"); |
devhammer | 0:271f8cc9758c | 41 | // wait(2); |
devhammer | 0:271f8cc9758c | 42 | // pc.printf("Text written to char display...\r\n"); |
devhammer | 0:271f8cc9758c | 43 | } |