Differential pressure meter
Dependencies: TFT_Touch_WaveShare
main.cpp
00001 #include "mbed.h" 00002 #include "stdio.h" 00003 #include "SPI_TFT.h" 00004 #include "string" 00005 #include "Arial12x12.h" 00006 #include "Arial24x23.h" 00007 00008 void print_char(char c = '*') 00009 { 00010 printf("%c", c); 00011 fflush(stdout); 00012 } 00013 00014 Thread thread; 00015 00016 DigitalOut led1(LED1); 00017 00018 void print_thread() 00019 { 00020 while (true) { 00021 wait(1); 00022 print_char(); 00023 } 00024 } 00025 00026 int main() 00027 { 00028 printf("\n\n*** RTOS basic example ***\n"); 00029 00030 thread.start(print_thread); 00031 00032 00033 00034 // the TFT is connected to SPI 00035 // PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset 00036 SPI_TFT TFT(PA_7, PA_6, PA_5, PB_6, PA_8,"TFT"); // mosi, miso, sclk, cs, reset 00037 00038 TFT.claim(stdout); // send stdout to the TFT display 00039 TFT.claim(stderr); // send stderr to the TFT display 00040 00041 TFT.background(Black); // set background to black 00042 TFT.foreground(White); // set chars to white 00043 TFT.cls(); // clear the screen 00044 TFT.set_font((unsigned char*) Arial12x12); // select the font 00045 00046 TFT.set_orientation(0); 00047 TFT.locate(0,0); 00048 printf(" Hello Mbed 0"); 00049 TFT.set_font((unsigned char*) Arial24x23); // select font 2 00050 TFT.locate(2,5); 00051 TFT.printf("Bigger Font"); 00052 00053 while (true) { 00054 led1 = !led1; 00055 wait(0.5); 00056 } 00057 }
Generated on Tue Jul 19 2022 13:55:32 by 1.7.2