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.
Dependencies: mbed
main.cpp@3:dbe3618192cd, 2018-03-13 (annotated)
- Committer:
- Emilio91
- Date:
- Tue Mar 13 17:52:11 2018 +0000
- Revision:
- 3:dbe3618192cd
- Parent:
- 2:78d57ebcfc3d
Niente
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
perlatecnica | 2:78d57ebcfc3d | 1 | /**************************************************** |
perlatecnica | 2:78d57ebcfc3d | 2 | * FAST PROTOTYPING WITH NUCLEO * |
perlatecnica | 2:78d57ebcfc3d | 3 | * Example Code 05: LCDdisplay * |
perlatecnica | 2:78d57ebcfc3d | 4 | * Author: Mauro D'Angelo * |
perlatecnica | 2:78d57ebcfc3d | 5 | * Organization: Perlatecnica no-profit organization * |
perlatecnica | 2:78d57ebcfc3d | 6 | *****************************************************/ |
bcostm | 0:4860a91fb495 | 7 | |
perlatecnica | 2:78d57ebcfc3d | 8 | #include "mbed.h" |
perlatecnica | 2:78d57ebcfc3d | 9 | #include "TextLCD.h" |
bcostm | 0:4860a91fb495 | 10 | |
Emilio91 | 3:dbe3618192cd | 11 | |
perlatecnica | 2:78d57ebcfc3d | 12 | // PCF8574T |
Emilio91 | 3:dbe3618192cd | 13 | //#define SLAVEADDRESS 0x4E |
perlatecnica | 2:78d57ebcfc3d | 14 | //PCF8574AT |
Emilio91 | 3:dbe3618192cd | 15 | #define SLAVEADDRESS 0x7E |
perlatecnica | 2:78d57ebcfc3d | 16 | |
Emilio91 | 3:dbe3618192cd | 17 | // Instanzia un oggetto I2C assegnando i due pin SDA ed SCL |
perlatecnica | 2:78d57ebcfc3d | 18 | I2C i2c_lcd(PB_9,PB_8); // SDA, SCL |
bcostm | 0:4860a91fb495 | 19 | |
perlatecnica | 2:78d57ebcfc3d | 20 | // Instanzia un oggetto TextLCD_I2C per la gestione del display via I2Cbus |
perlatecnica | 2:78d57ebcfc3d | 21 | TextLCD_I2C lcd(&i2c_lcd,SLAVEADDRESS, TextLCD::LCD16x2); // I2C exp: I2C bus, PCF8574AT Slaveaddress, LCD Type |
perlatecnica | 2:78d57ebcfc3d | 22 | |
perlatecnica | 2:78d57ebcfc3d | 23 | //0x7e, |
bcostm | 0:4860a91fb495 | 24 | int main() { |
perlatecnica | 2:78d57ebcfc3d | 25 | // Spegne il cursore |
perlatecnica | 2:78d57ebcfc3d | 26 | lcd.setCursor(TextLCD::CurOff_BlkOff); |
bcostm | 0:4860a91fb495 | 27 | |
perlatecnica | 2:78d57ebcfc3d | 28 | // Pulisce lo schermo |
perlatecnica | 2:78d57ebcfc3d | 29 | lcd.cls(); |
perlatecnica | 2:78d57ebcfc3d | 30 | |
perlatecnica | 2:78d57ebcfc3d | 31 | // Stampa sullo schermo |
Emilio91 | 3:dbe3618192cd | 32 | lcd.printf("LCD:"); |
bcostm | 0:4860a91fb495 | 33 | |
perlatecnica | 2:78d57ebcfc3d | 34 | // punta alla prima colonna del secondo rigo del display |
perlatecnica | 2:78d57ebcfc3d | 35 | lcd.setAddress(0, 1); |
perlatecnica | 2:78d57ebcfc3d | 36 | |
perlatecnica | 2:78d57ebcfc3d | 37 | // Stampa sullo schermo |
Emilio91 | 3:dbe3618192cd | 38 | lcd.printf("FUNZIONAAAA"); |
perlatecnica | 2:78d57ebcfc3d | 39 | wait(2); |
perlatecnica | 2:78d57ebcfc3d | 40 | } |