Programmi Esempio
/
Sd_Card
Sd Card
main.cpp@2:78d57ebcfc3d, 2015-11-02 (annotated)
- Committer:
- perlatecnica
- Date:
- Mon Nov 02 13:53:31 2015 +0000
- Revision:
- 2:78d57ebcfc3d
- Parent:
- 0:4860a91fb495
- Child:
- 3:ab83735eefc3
v1.0
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 | |
perlatecnica | 2:78d57ebcfc3d | 11 | // PCF8574T |
perlatecnica | 2:78d57ebcfc3d | 12 | #define SLAVEADDRESS 0x4E |
perlatecnica | 2:78d57ebcfc3d | 13 | //PCF8574AT |
perlatecnica | 2:78d57ebcfc3d | 14 | //#define SLAVEADDRESS 0x7E |
perlatecnica | 2:78d57ebcfc3d | 15 | |
perlatecnica | 2:78d57ebcfc3d | 16 | // Instanzia un oggetto I2C assegnando i du pin SDA ed SCL |
perlatecnica | 2:78d57ebcfc3d | 17 | I2C i2c_lcd(PB_9,PB_8); // SDA, SCL |
bcostm | 0:4860a91fb495 | 18 | |
perlatecnica | 2:78d57ebcfc3d | 19 | // Instanzia un oggetto TextLCD_I2C per la gestione del display via I2Cbus |
perlatecnica | 2:78d57ebcfc3d | 20 | TextLCD_I2C lcd(&i2c_lcd,SLAVEADDRESS, TextLCD::LCD16x2); // I2C exp: I2C bus, PCF8574AT Slaveaddress, LCD Type |
perlatecnica | 2:78d57ebcfc3d | 21 | |
perlatecnica | 2:78d57ebcfc3d | 22 | //0x7e, |
bcostm | 0:4860a91fb495 | 23 | int main() { |
perlatecnica | 2:78d57ebcfc3d | 24 | // Spegne il cursore |
perlatecnica | 2:78d57ebcfc3d | 25 | lcd.setCursor(TextLCD::CurOff_BlkOff); |
bcostm | 0:4860a91fb495 | 26 | |
perlatecnica | 2:78d57ebcfc3d | 27 | // Pulisce lo schermo |
perlatecnica | 2:78d57ebcfc3d | 28 | lcd.cls(); |
perlatecnica | 2:78d57ebcfc3d | 29 | |
perlatecnica | 2:78d57ebcfc3d | 30 | // Stampa sullo schermo |
perlatecnica | 2:78d57ebcfc3d | 31 | lcd.printf(" Welcome to"); |
bcostm | 0:4860a91fb495 | 32 | |
perlatecnica | 2:78d57ebcfc3d | 33 | // punta alla prima colonna del secondo rigo del display |
perlatecnica | 2:78d57ebcfc3d | 34 | lcd.setAddress(0, 1); |
perlatecnica | 2:78d57ebcfc3d | 35 | |
perlatecnica | 2:78d57ebcfc3d | 36 | // Stampa sullo schermo |
perlatecnica | 2:78d57ebcfc3d | 37 | lcd.printf("LCD display demo"); |
perlatecnica | 2:78d57ebcfc3d | 38 | wait(2); |
perlatecnica | 2:78d57ebcfc3d | 39 | } |