Pecunia_Insper
/
Main
VEjam se o MAin funciona
main.cpp@0:5661dfef7807, 2018-05-10 (annotated)
- Committer:
- gianlucamgf
- Date:
- Thu May 10 14:09:51 2018 +0000
- Revision:
- 0:5661dfef7807
- Child:
- 1:405e88f6e720
Main
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gianlucamgf | 0:5661dfef7807 | 1 | #include "mbed.h" |
gianlucamgf | 0:5661dfef7807 | 2 | #include "TextLCD.h" |
gianlucamgf | 0:5661dfef7807 | 3 | |
gianlucamgf | 0:5661dfef7807 | 4 | // Host PC Communication channels |
gianlucamgf | 0:5661dfef7807 | 5 | Serial pc(USBTX, USBRX); // tx, rx |
gianlucamgf | 0:5661dfef7807 | 6 | |
gianlucamgf | 0:5661dfef7807 | 7 | // I2C Communication |
gianlucamgf | 0:5661dfef7807 | 8 | I2C i2c_lcd(D14,D15); // SDA, SCL |
gianlucamgf | 0:5661dfef7807 | 9 | |
gianlucamgf | 0:5661dfef7807 | 10 | |
gianlucamgf | 0:5661dfef7807 | 11 | TextLCD_I2C lcd(&i2c_lcd, 0x7F, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type |
gianlucamgf | 0:5661dfef7807 | 12 | |
gianlucamgf | 0:5661dfef7807 | 13 | |
gianlucamgf | 0:5661dfef7807 | 14 | int main() { |
gianlucamgf | 0:5661dfef7807 | 15 | |
gianlucamgf | 0:5661dfef7807 | 16 | // Show cursor as blinking character |
gianlucamgf | 0:5661dfef7807 | 17 | lcd.setCursor(TextLCD::CurOff_BlkOn); |
gianlucamgf | 0:5661dfef7807 | 18 | lcd.setBacklight(TextLCD::LightOn); |
gianlucamgf | 0:5661dfef7807 | 19 | |
gianlucamgf | 0:5661dfef7807 | 20 | // Set and show user defined characters. A maximum of 8 UDCs are supported by the HD44780. |
gianlucamgf | 0:5661dfef7807 | 21 | // They are defined by a 5x7 bitpattern. |
gianlucamgf | 0:5661dfef7807 | 22 | lcd.setAddress(5,2); |
gianlucamgf | 0:5661dfef7807 | 23 | lcd.printf("salve"); |
gianlucamgf | 0:5661dfef7807 | 24 | wait_ms(2000); |
gianlucamgf | 0:5661dfef7807 | 25 | lcd.cls(); |
gianlucamgf | 0:5661dfef7807 | 26 | lcd.setAddress(5,2); |
gianlucamgf | 0:5661dfef7807 | 27 | lcd.printf("..."); |
gianlucamgf | 0:5661dfef7807 | 28 | wait_ms(2000); |
gianlucamgf | 0:5661dfef7807 | 29 | lcd.cls(); |
gianlucamgf | 0:5661dfef7807 | 30 | lcd.setAddress(5,2); |
gianlucamgf | 0:5661dfef7807 | 31 | lcd.printf("seu otario"); |
gianlucamgf | 0:5661dfef7807 | 32 | |
gianlucamgf | 0:5661dfef7807 | 33 | } |