Programmi Esempio
/
Sd_Card
Sd Card
main.cpp@5:d261737139c5, 2017-06-10 (annotated)
- Committer:
- LorenzoCR
- Date:
- Sat Jun 10 13:52:19 2017 +0000
- Revision:
- 5:d261737139c5
- Parent:
- 4:b95e3e1f207e
- Child:
- 6:fbb45da9487c
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 |
LorenzoCR | 5:d261737139c5 | 31 | for (int I=0; I<=12; I++){ |
LorenzoCR | 5:d261737139c5 | 32 | lcd.setAddress(I, 0); |
LorenzoCR | 5:d261737139c5 | 33 | lcd.printf("Sono"); |
bcostm | 0:4860a91fb495 | 34 | |
perlatecnica | 2:78d57ebcfc3d | 35 | // punta alla prima colonna del secondo rigo del display |
perlatecnica | 2:78d57ebcfc3d | 36 | lcd.setAddress(0, 1); |
perlatecnica | 2:78d57ebcfc3d | 37 | |
perlatecnica | 2:78d57ebcfc3d | 38 | // Stampa sullo schermo |
LorenzoCR | 5:d261737139c5 | 39 | lcd.printf("Tammaro"); |
LorenzoCR | 5:d261737139c5 | 40 | wait(1);} |
LorenzoCR | 5:d261737139c5 | 41 | |
perlatecnica | 2:78d57ebcfc3d | 42 | } |