Kamil Ondrousek / Mbed 2 deprecated Lorenz

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "TFT_4DGL.h"
00002 
00003 TFT_4DGL lcd(p9,p10,p11);
00004 
00005 int main() {
00006 
00007     double x1,y1,z1,x,y,z,t,dt;
00008     int   xp,yp;
00009    
00010     x1=(y1=(z1=(t=0.0001)));
00011     
00012     dt=0.01;
00013 
00014     while(1)
00015     
00016     {
00017     
00018         x = x1+(-10.0*x1+10.0*y1)*dt;
00019         y = y1+(28.0*x1-y1-x1*z1)*dt;
00020         z = z1+(-(8/3)*z1+x1*y1)*dt;
00021         t = t+dt;
00022 
00023         xp = 150+(int)floor(7*x);
00024         yp = 10+(int)floor(4*z);
00025 
00026         lcd.pixel(yp,xp,WHITE);
00027       
00028         x1 = x;
00029         y1 = y;
00030         z1 = z;
00031 
00032     }
00033  
00034 }