Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed
Fork of MainSketch by
Diff: main.cpp
- Revision:
- 1:e0479f60cd48
- Parent:
- 0:7c3b9bfd6ead
- Child:
- 2:25bfb21253a6
diff -r 7c3b9bfd6ead -r e0479f60cd48 main.cpp
--- a/main.cpp Sun Jan 26 20:55:50 2014 +0000
+++ b/main.cpp Mon Oct 20 11:05:02 2014 +0000
@@ -14,20 +14,22 @@
#include "SDFileSystem.h"
// the SD-connector is connected to SPI pin 11-13
-SDFileSystem sd(p11, p12, p13, p14, "sd"); // mosi,miso,sck,cs
+//SDFileSystem sd(p11, p12, p13, p14, "sd"); // mosi,miso,sck,cs
-LocalFileSystem local("local");
+//LocalFileSystem local("local");
extern unsigned char p1[]; // the mbed logo graphic
// the display has a backlight switch on board
-DigitalOut LCD_LED(p21);
+DigitalOut LCD_LED(PTA13);
// 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
+//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, PTC12,"TFT"); // mosi, miso, sclk, cs, reset, dc for frdmkl25z
int main()
{
+ while(1){
int i;
LCD_LED = 1; // backlite on
@@ -54,12 +56,43 @@
TFT.set_orientation(3);
TFT.locate(0,0);
printf(" Hello Mbed 3");
- TFT.set_orientation(1);
+ TFT.set_orientation(3);
TFT.set_font((unsigned char*) Arial24x23);
TFT.locate(50,100);
TFT.printf("TFT orientation");
- wait(5); // wait two seconds
+ wait(1); // wait two seconds
+ TFT.cls();
+ LCD_LED = 1;
+ TFT.set_font((unsigned char*) Arial12x12);
+ TFT.locate(1,10);
+ TFT.foreground(Green);
+ TFT.printf("Depth Max Depth Dive Time");
+ TFT.locate(1,24);
+ TFT.foreground(White);
+ TFT.set_font((unsigned char*) Arial28x28);
+ TFT.printf("32.4m");
+
+ TFT.locate(130,24);
+ TFT.foreground(White);
+ TFT.set_font((unsigned char*) Arial24x23);
+ TFT.printf("45.6m");
+ TFT.locate(240,24);
+ TFT.printf("37'");
+
+ TFT.locate(1,70);
+ TFT.set_font((unsigned char*) Arial12x12);
+ TFT.foreground(Green);
+ TFT.printf("ppO2:\nSensor 1 Sensor 2 Sensor 3");
+
+ TFT.locate(1,100);
+ TFT.foreground(White);
+ TFT.set_font((unsigned char*) Arial28x28);
+ TFT.printf("1.21 1.21 1.21");
+ wait(10);
+
+ /*
+ wait(5);
// draw some graphics
TFT.cls();
@@ -125,14 +158,19 @@
// to compare the speed of the internal file system and a SD-card
TFT.locate(10,10);
TFT.printf("Graphic from internal File System");
- TFT.locate(10,20);
+ TFT.locate(20,20);
TFT.printf("open test.bmp");
- int err = TFT.BMP_16(1,50,"/local/test.bmp");
+ int err = TFT.BMP_16(50,50,"/local/test.bmp");
if (err != 1) TFT.printf(" - Err: %d",err);
-
- TFT.locate(10,110);
- TFT.printf("Graphic from external SD-card");
- TFT.locate(10,120);
- err = TFT.BMP_16(1,140,"/sd/test.bmp");
- if (err != 1) TFT.printf(" - Err: %d",err);
+ wait(5);
+ for(i=0;i<10;i++){
+ LCD_LED = 1;
+ wait(0.2);
+ LCD_LED = 0;
+ wait(0.2);
+ }
+
+ */
+ }
+
}
