Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LCD_COG Class Reference
LCD example. More...
#include <MCC0G42005A6W.h>
Public Member Functions | |
| LCD_COG (PinName I2C_sda, PinName I2C_scl, const char *init_message=NULL) | |
| Create a LCD instance which is connected to specified I2C pins with specified address. | |
| LCD_COG (I2C &i2c_, const char *init_message=NULL) | |
| Create a LCD instance connected to specified I2C pins with specified address. | |
| ~LCD_COG () | |
| Destructor. | |
| void | printf (char line, const char *format,...) |
| Printf. | |
| void | printf (char x, unsigned char y, const char *format,...) |
| Printf. | |
| void | putc (unsigned char line, char c) |
| Put character : "putc()". | |
| void | puts (char line, const char *s) |
| Put string : "puts()". | |
| void | putcxy (char c, unsigned char x, unsigned char y) |
| Put character into specified screen position. | |
| void | clear (void) |
| Clear the LCD. | |
| void | contrast (char contrast) |
| Contrast adjustment. | |
| void | put_custom_char (char c_code, const char *cg, char x, char y) |
| Put a custom character given as bitmap data. | |
| void | set_CGRAM (char char_code, const char *cg) |
| Set CGRAM (set custom bitmap as a character) | |
| void | set_CGRAM (char char_code, char v) |
| Set CGRAM (set custom bitmap as a character) | |
| void | setCharsInLine (char ch) |
| Set number of characters in a line. | |
Detailed Description
LCD example.
#include <stdarg.h> #include "mbed.h" #include "MCC0G42005A6W.h" // MCCOG42005A6W-BNMLWI // Alphanumeric LCD, 20 x 4, White on Blue, 3V to 5V, I2C, English, Japanese, Transmissive // Farnell nr. 2218946 // example PCB LCD I2C 4x20 https://circuitmaker.com/User/Details/Rob-Keij-4 LCD_COG lcd(SDA, SCL, "==LCD=Driver=V1.00=="); // SDA, SCL int main() { lcd.printf( 0, 0, "Hello world!" ); lcd.printf( 4, 1, "pi = %.6f", 3.14159265 ); lcd.printf( 2, 2, "This is Row %d",2 ); lcd.printf( 3, 3, "This is Row %d",3 ); while(1) { } }
Definition at line 38 of file MCC0G42005A6W.h.
Constructor & Destructor Documentation
| LCD_COG | ( | PinName | I2C_sda, |
| PinName | I2C_scl, | ||
| const char * | init_message = NULL |
||
| ) |
Create a LCD instance which is connected to specified I2C pins with specified address.
- Parameters:
-
I2C_sda I2C-bus SDA pin I2C_scl I2C-bus SCL pin init_message string to initialize the LCD
Definition at line 10 of file MCC0G42005A6W.cpp.
| LCD_COG | ( | I2C & | i2c_, |
| const char * | init_message = NULL |
||
| ) |
Create a LCD instance connected to specified I2C pins with specified address.
- Parameters:
-
I2C object (instance) init_message string to initialize the LCD
Definition at line 17 of file MCC0G42005A6W.cpp.
| ~LCD_COG | ( | ) |
Destructor.
Definition at line 23 of file MCC0G42005A6W.cpp.
Member Function Documentation
| void clear | ( | void | ) |
Clear the LCD.
Definition at line 143 of file MCC0G42005A6W.cpp.
| void contrast | ( | char | contrast ) |
Contrast adjustment.
- Parameters:
-
contrast value (from 0x00 to 0x3E)
Definition at line 154 of file MCC0G42005A6W.cpp.
| void printf | ( | char | x, |
| unsigned char | y, | ||
| const char * | format, | ||
| ... | |||
| ) |
Printf.
printf function with X and Y character position on the LCD. it can be used like
lcd.printf( 0, 0, "Hello world!" ); lcd.printf( 4, 1, "pi = %.6f", 3.14159265 ); lcd.printf( 2, 2, "This is Row %d",2 ); lcd.printf( 3, 3, "This is Row %d",3 );
- Parameters:
-
x X horizontal character position on the LCD y Y vertical character position on the LCD format following parameters are compatible to stdout's printf
Definition at line 94 of file MCC0G42005A6W.cpp.
| void printf | ( | char | line, |
| const char * | format, | ||
| ... | |||
| ) |
Printf.
printf function with line number. it can be used like
lcd.printf( 0, "Hello world!" ); lcd.printf( 1, "pi = %.6f", 3.14159265 ); lcd.printf( 2, "This is Row %d",2 ); lcd.printf( 3, "This is Row %d",3 );
- Parameters:
-
line line# (0 for upper, 1 for lower) format following parameters are compatible to stdout's printf
Definition at line 79 of file MCC0G42005A6W.cpp.
| void put_custom_char | ( | char | c_code, |
| const char * | cg, | ||
| char | x, | ||
| char | y | ||
| ) |
Put a custom character given as bitmap data.
- Parameters:
-
c_code character code cg pointer to bitmap data (array of 8 bytes) x horizontal character position on the LCD y vertical character position on the LCD
Definition at line 164 of file MCC0G42005A6W.cpp.
| void putc | ( | unsigned char | line, |
| char | c | ||
| ) |
Put character : "putc()".
- Parameters:
-
line line# (0 for upper, 1 for lower) c character code
Definition at line 108 of file MCC0G42005A6W.cpp.
| void putcxy | ( | char | c, |
| unsigned char | x, | ||
| unsigned char | y | ||
| ) |
Put character into specified screen position.
- Parameters:
-
c character code x horizontal character position on the LCD y vertical character position on the LCD
Definition at line 129 of file MCC0G42005A6W.cpp.
| void puts | ( | char | line, |
| const char * | s | ||
| ) |
Put string : "puts()".
- Parameters:
-
line line# (0 for upper, 1 for lower) s pointer to a string data
Definition at line 121 of file MCC0G42005A6W.cpp.
| void set_CGRAM | ( | char | char_code, |
| char | v | ||
| ) |
Set CGRAM (set custom bitmap as a character)
- Parameters:
-
c_code character code v bitmap data (5 bit pattern in this variable are copied to all row of a character bitmap)
Definition at line 184 of file MCC0G42005A6W.cpp.
| void set_CGRAM | ( | char | char_code, |
| const char * | cg | ||
| ) |
Set CGRAM (set custom bitmap as a character)
- Parameters:
-
c_code character code cg pointer to bitmap data (array of 8 bytes)
Definition at line 174 of file MCC0G42005A6W.cpp.
| void setCharsInLine | ( | char | ch ) |
Set number of characters in a line.
- Parameters:
-
ch number of charactors in a line
Definition at line 152 of file MCC0G42005A6W.h.
Generated on Tue Jul 12 2022 16:15:28 by
1.7.2