Duffing fractal map

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 = 2.75;
00008     float b = 0.1;
00009 
00010     float x = 0;
00011     float y = 1;
00012 
00013     int xout = 0;
00014     int yout = 0;
00015  
00016  while (1) {
00017  
00018     double oldX = x;
00019   
00020     x = y;
00021     y = -b*oldX+a*y-pow(y,3);
00022   
00023     xout = 160+(x*80);
00024     yout = 120+(y*60);
00025    
00026     lcd.pixel(yout,xout,WHITE);
00027   
00028 }
00029 }