Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "TFT_4DGL.h" 00002 00003 TFT_4DGL lcd(p9,p10,p11); 00004 00005 int main() { 00006 00007 float xmin = -2.5; 00008 float ymin = -2.0; 00009 float wh = 4; 00010 00011 int maxiterations = 100; 00012 int width = 320; 00013 int height = 320; 00014 00015 float xmax = xmin+wh; 00016 00017 float ymax = ymin+wh; 00018 00019 float dx = (xmax - xmin) / (width); 00020 float dy = (ymax - ymin) / (height); 00021 00022 float y = ymin; 00023 00024 00025 for (int j = 0; j < (height); j++) { 00026 00027 float x = xmin; 00028 for (int i = 0; i < width; i++) { 00029 00030 float a = x; 00031 float b = y; 00032 int n = 0; 00033 while (n < maxiterations) { 00034 00035 float aa = a * a; 00036 float bb = b * b; 00037 float twoab = 2.0 * a * b; 00038 a = aa - bb + x; 00039 b = twoab + y; 00040 00041 if(aa + bb > 16.0) { 00042 break; 00043 } 00044 n++; 00045 } 00046 00047 if (n == maxiterations) { 00048 00049 } else { 00050 00051 lcd.pixel(120+80*y,210+80*x,n*n*n*n*n*n*n*n); 00052 00053 } 00054 x += dx; 00055 } 00056 y += dy; 00057 } 00058 00059 }
Generated on Sun Jul 17 2022 13:59:43 by
1.7.2