A simple TFT sketch with randomness, results look like Johnathan Pollack's paintings.
A colored point (seven basic colors; red, yel, grn, cyn, blu, mag, wht, blk) can move in any of nine directions (up, down, left, right, ul, ur, ll, lr, stay), and wraps around screen boundaries, then after 1000 points, changes colors.
#include <Arduino_Nesso_N1.h> // https://github.com/m5stack/M5GFX/blob/master/src/lgfx/v1/LGFXBase.hpp
NessoDisplay display;
#define h 240
#define w 135
byte i, j, x, y;
int change = 5000, count, color, c, r, g, b;
void setup() {
Serial.begin(115200);
display.begin();
display.fillScreen(TFT_BLACK);
}
void loop() {
i = random(-1, 2); // -1, 0, 1
j = random(-1, 2);
x += i;
y += j;
if (x > w) x = 0;
if (x < 0) x = w - 1;
if (y > h) y = 0;
if (y < 0) y = h - 1;
if (count++ > change) {
count = 0;
if (color++ > 7)
color = 0;
r = 31 * bitRead(color, 2); // 1xx
g = 63 * bitRead(color, 1); // x1x
b = 31 * bitRead(color, 0); // xx1
c = r << 11 | g << 5 | b;
}
// showvalues(); // debug values
display.drawPixel(x, y, c);
}
void showvalues() {
pad(x);
pad(y);
pad(r);
pad(g);
pad(b);
pad(c);
Serial.println();
}
void pad(int val) {
Serial.print("0x");
if (val < 0x1000)
Serial.print("0");
if (val < 0x100)
Serial.print("0");
if (val < 0x10)
Serial.print("0");
Serial.print(val, HEX);
Serial.print(" ");
}