Henon map - Mod2 color

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     float a = 0.2;
00008     float b = -0.9991;
00009 
00010     float x = 0.1;
00011     float y = 0.1;
00012 
00013     int xout = 0;
00014     int yout = 0;
00015     int n = WHITE;
00016     int m = 0;
00017  
00018  while (1) {
00019  
00020     double x1 = x;
00021     double y1 = y;
00022   
00023     x = y1+1-a*pow(x1,2);
00024     y = b*x1;
00025     
00026     m++;
00027     
00028     if (m==100) {
00029     
00030     m = 0;
00031     
00032     n = rand();
00033     
00034     }
00035   
00036     xout = 50+(150*x);
00037     yout = 265+(210*y);
00038    
00039     lcd.pixel(xout,yout,n);
00040   
00041 }
00042 }