Programmi Esempio
/
Sd_Card
Sd Card
main.cpp@4:b95e3e1f207e, 2017-01-09 (annotated)
- Committer:
- MikGa87
- Date:
- Mon Jan 09 10:54:23 2017 +0000
- Revision:
- 4:b95e3e1f207e
- Parent:
- 3:ab83735eefc3
- Child:
- 5:d261737139c5
change text
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 |
MikGa87 | 3:ab83735eefc3 | 12 | //define SLAVEADDRESS 0x4E |
perlatecnica | 2:78d57ebcfc3d | 13 | //PCF8574AT |
MikGa87 | 3:ab83735eefc3 | 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 |
MikGa87 | 4:b95e3e1f207e | 37 | lcd.printf("STM32 Testing"); |
perlatecnica | 2:78d57ebcfc3d | 38 | wait(2); |
perlatecnica | 2:78d57ebcfc3d | 39 | } |