code c++ carte KL25Z avec écran TFT Qr4 526S01 TP28017 oscilloscope (en développement)

Dependencies:   poirier-proj-95 TFT_fonts mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "SeeedStudioTFTv2.h"
00003 #include "Arial12x12.h"
00004 #include "Arial24x23.h"
00005 #include "Arial28x28.h"
00006 #include "font_big.h"
00007 #include "diver.h"
00008     PwmOut rled(LED_RED);    // init 
00009     PwmOut gled(LED_GREEN);
00010     PwmOut bled(LED_BLUE);
00011     SeeedStudioTFTv2 TFT(PTB3, PTB1, PTB2, PTB0, PTD2, PTD3, PTD1, PTA5, PTC8, PTC9, PTA4);
00012     
00013     DigitalOut sortie01(PTA1);
00014     AnalogIn entree01(PTC2);
00015 
00016 
00017 
00018 int main()
00019 {
00020     //TFT.calibrate(); // CALIBRAGE DE L ECRAN
00021     //point  pt;    
00022     int var_menu=0;
00023     int i,k;
00024     float vs;
00025     float tab[200];
00026     while(var_menu == 0)//=============================================== MENU PRINCIPAL =======================================================================
00027         {  
00028         
00029             for(k=0;k<4;k++)
00030                 {
00031                     sortie01 = 0;
00032                     for(i=0;i<50;i++)
00033                         {
00034                             wait_us(2); // 100/50 = 2
00035                             vs = entree01.read();
00036                             tab[i]=vs;
00037                         }
00038                     sortie01 = 1;
00039                     for(i=51;i<100;i++)
00040                         {
00041                             wait_us(2); // 100/50 = 2
00042                             vs = entree01.read();
00043                             tab[i]=vs;
00044                         }            
00045                     sortie01 = 0;
00046                     for(i=101;i<150;i++)
00047                         {
00048                             wait_us(2); // 100/50 = 2
00049                             vs = entree01.read();
00050                             tab[i]=vs;
00051                         }
00052                     sortie01 = 1;
00053                     for(i=151;i<200;i++)
00054                         {
00055                             wait_us(2); // 100/50 = 2
00056                             vs = entree01.read();
00057                             tab[i]=vs;
00058                         }
00059                 }
00060             for(i=0;i<200;i++)
00061                 {
00062                     TFT.line(i,200-50*tab[i],i+1,200-50*tab[i+1],Green);               
00063                 }
00064             wait(1);
00065             TFT.fillrect(0,0,240,320,Black);
00066                 
00067         }//fin du while(var_menu==0);    
00068   
00069 }//fin main