Liceo Statale Gandhi / Mbed 2 deprecated STMNucleoF401RE_ExampleCode_05_LCDddd

Dependencies:   mbed TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 
00004 // PCF8574T
00005 //define SLAVEADDRESS 0x4E 
00006 //PCF8574AT
00007 #define SLAVEADDRESS 0x7E
00008 
00009 // Instanzia un oggetto I2C assegnando i du pin SDA ed SCL
00010 I2C i2c_lcd(PB_9,PB_8); // SDA, SCL
00011 
00012 // Instanzia un oggetto TextLCD_I2C per la gestione del display via I2Cbus
00013 TextLCD_I2C lcd(&i2c_lcd,SLAVEADDRESS,  TextLCD::LCD16x2); // I2C exp: I2C bus, PCF8574AT Slaveaddress, LCD Type
00014 
00015 //0x7e,
00016 int main() {
00017     // Spegne il cursore
00018     lcd.setCursor(TextLCD::CurOff_BlkOff);
00019     
00020     // Pulisce lo schermo
00021     lcd.cls();
00022     // punta alla prima colonna del secondo rigo del display
00023     lcd.setAddress(0, 0);
00024     lcd.printf("Sono");
00025     
00026     
00027     lcd.setAddress(0, 1);
00028     
00029     // Stampa sullo schermo
00030     lcd.printf("Tammaro");
00031     wait(1);}
00032     
00033 }