![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Both displays functioning independently, we will use this program to bring them both into the same code.
Dependencies: SPI_TFT_ILI9341 TFT_fonts TextLCD mbed
main.cpp
- Committer:
- JHutchinson
- Date:
- 2017-05-24
- Revision:
- 0:51158f3940e0
- Child:
- 1:889816eeff83
File content as of revision 0:51158f3940e0:
#include "mbed.h" #include "TextLCD.h" #include "stdio.h" #include "SPI_TFT_ILI9341.h" #include "string" #include "Arial12x12.h" #include "Arial24x23.h" #include "Arial28x28.h" #include "font_big.h" // Host PC Communication channels Serial pc(USBTX, USBRX); // tx, rx // LCD instantiation TextLCD lcd(PTC7, PTC0, PTC3, PTC4, PTC5, PTC6); // 4bit bus: rs, e, d4-d7 // the display has a backlight switch on board DigitalOut LCD_LED(PTA13); DigitalOut pwr(PTD7); // the TFT is connected to SPI pin 5-7 //SPI_TFT_ILI9341 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc for lpc1768 SPI_TFT_ILI9341 TFT(PTD2, PTD3, PTD1, PTD5, PTD0, PTA13,"TFT"); // mosi, miso, sclk, cs, reset, dc for frdmkl25z //void updateDisplay(int time, int date) { int main() { int time = 1234; int date = 221217; int temp = 27; // Adjust format of time to reflect hours and minutes int hours = time/100; int minutes = time - hours*100; // Adjust format of date to reflect days and minutes int day = date/10000; int month = (date - day*10000)/100; int year = date - month*100 - day*10000; // Print correctly spaced values on the display lcd.printf("Time %d:%d", hours, minutes); // Locate cursor to start of second line lcd.setAddress(0, 1); lcd.printf("Date %d/%d/%d", day, month, year); pwr=1; LCD_LED = 1; // backlight on TFT.claim(stdout); // send stdout to the TFT display TFT.set_orientation(1); TFT.background(Black); // set background to black TFT.foreground(White); // set chars to white TFT.cls(); // clear the screen TFT.set_orientation(0); TFT.background(Black); TFT.cls(); TFT.set_font((unsigned char*) Arial28x28); TFT.locate(102,220); // x,y printf("%d", temp); }