Programmi Esempio
/
Sd_Card
Sd Card
main.cpp@6:fbb45da9487c, 2018-12-18 (annotated)
- Committer:
- gandhi1
- Date:
- Tue Dec 18 22:50:37 2018 +0000
- Revision:
- 6:fbb45da9487c
- Parent:
- 5:d261737139c5
lcd
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
perlatecnica | 2:78d57ebcfc3d | 1 | #include "mbed.h" |
perlatecnica | 2:78d57ebcfc3d | 2 | #include "TextLCD.h" |
bcostm | 0:4860a91fb495 | 3 | |
perlatecnica | 2:78d57ebcfc3d | 4 | // PCF8574T |
MikGa87 | 3:ab83735eefc3 | 5 | //define SLAVEADDRESS 0x4E |
perlatecnica | 2:78d57ebcfc3d | 6 | //PCF8574AT |
MikGa87 | 3:ab83735eefc3 | 7 | #define SLAVEADDRESS 0x7E |
perlatecnica | 2:78d57ebcfc3d | 8 | |
perlatecnica | 2:78d57ebcfc3d | 9 | // Instanzia un oggetto I2C assegnando i du pin SDA ed SCL |
perlatecnica | 2:78d57ebcfc3d | 10 | I2C i2c_lcd(PB_9,PB_8); // SDA, SCL |
bcostm | 0:4860a91fb495 | 11 | |
perlatecnica | 2:78d57ebcfc3d | 12 | // Instanzia un oggetto TextLCD_I2C per la gestione del display via I2Cbus |
perlatecnica | 2:78d57ebcfc3d | 13 | TextLCD_I2C lcd(&i2c_lcd,SLAVEADDRESS, TextLCD::LCD16x2); // I2C exp: I2C bus, PCF8574AT Slaveaddress, LCD Type |
perlatecnica | 2:78d57ebcfc3d | 14 | |
perlatecnica | 2:78d57ebcfc3d | 15 | //0x7e, |
bcostm | 0:4860a91fb495 | 16 | int main() { |
perlatecnica | 2:78d57ebcfc3d | 17 | // Spegne il cursore |
perlatecnica | 2:78d57ebcfc3d | 18 | lcd.setCursor(TextLCD::CurOff_BlkOff); |
bcostm | 0:4860a91fb495 | 19 | |
perlatecnica | 2:78d57ebcfc3d | 20 | // Pulisce lo schermo |
perlatecnica | 2:78d57ebcfc3d | 21 | lcd.cls(); |
gandhi1 | 6:fbb45da9487c | 22 | // punta alla prima colonna del secondo rigo del display |
gandhi1 | 6:fbb45da9487c | 23 | lcd.setAddress(0, 0); |
LorenzoCR | 5:d261737139c5 | 24 | lcd.printf("Sono"); |
bcostm | 0:4860a91fb495 | 25 | |
gandhi1 | 6:fbb45da9487c | 26 | |
perlatecnica | 2:78d57ebcfc3d | 27 | lcd.setAddress(0, 1); |
perlatecnica | 2:78d57ebcfc3d | 28 | |
perlatecnica | 2:78d57ebcfc3d | 29 | // Stampa sullo schermo |
LorenzoCR | 5:d261737139c5 | 30 | lcd.printf("Tammaro"); |
LorenzoCR | 5:d261737139c5 | 31 | wait(1);} |
LorenzoCR | 5:d261737139c5 | 32 | |
perlatecnica | 2:78d57ebcfc3d | 33 | } |