© ArduTV 2025

In this super-simple example a Mandelbrot-Set is drawn on the television using an Arduino UNO board. Changing the cR, cX, zR and zX parameters you can "explore" the set!
NOTE: the code is an adaptation to ArduTV command of the code found on this thread here: https://forum.arduino.cc/t/help-me-to-solve-how-to-draw-mandelbrot/609925/8, so thanks to "arduino1445ll" and "johnwasser".
#include <ArduTV.h>
ArduTV HDMI1(10);
void setup() {
HDMI1.begin();
HDMI1.BGColor(20,20,20);
HDMI1.PenColorDir(234);
HDMI1.Clear();
}
void loop() {
for(int y = 240; y > -240; y--){
for(int x = -320; x < 320; x++){
float cR = x/120.0;
float cX = y/120.0;
float zR = 0.5;
float zX = 1;
int r = 0;
do{
r++;
float old_zR = zR;
zR = cR+((zR*zR)-(zX*zX));
zX = (2*old_zR*zX)+cX;
} while(!(r > 50 || zR > 2));
if (zR < 2){
HDMI1.PointDir(x+320, y+240,0);
}
else{
HDMI1.PointDir(x+320, y+240,r*5000);
}
}
}
}


© ArduTV 2025