// ILI9341 library example
// Amiga Boing Ball Demo
// (c) 2019-20 Pawel A. Hernik
// cbm80amiga has some excellent libraries on cbm80amiga · GitHub
// YT video: Amiga Boing Ball Demo on AVR Arduino and ST7735 SPI display - YouTube
// I have always been fascinated by the Amiga Ball.
// and have adapted cbm80amiga's example sketch for
// diff geometry and diff libraries
// many libraries support GFX graphics.
It works quite nicely even on a Uno with big displays.
David.
amigaball.zip (4.91 KB)
Hi David,
I am one of the three folks who downloaded the sketch. I tried it on a 3.5 INCH 320X480 TFT display controlled by an ILI9486 chip. Worked at once,. The sketch runs on an Arduino Nano (my analog test bench).
I admire the programming. Going to do some research now how all this stuff works. Amazing, amazing.
Thanks! Photoncatcher
I adapted from cbm80amiga example. I presume that he adapted from the original CBM code.
The animation is simple. You just have 15 frames that represent a 30 degree rotation. i.e. 360 / number of squares on diameter. The next 30 degree rotation looks exactly the same ...
Just like RoadRunner runs past "similar" cactus plants
The background is redrawn. The "rotating" ball is just drawn in a new position.
I had wondered how it was done too.
I presume that you used a Parallel library. The ILI9486 is painful in SPI.
David.
Hi David,
I am using these libraries with my display that reports "ILI8496" when you interrogate its ID:
#include <SPI.h> // f.k. for Arduino-1.5.2
#include <Adafruit_GFX.h> // hardware-specific library
#include <MCUFRIEND_kbv.h> // hardware-specific library
changed the dimensions into 480x320.
Further on in the sketch I note that ILI9341 is (maybe) forced upon this display - which it endures.
I need to review this sketch step by step and run it with other TFTs in my arsenal. So intimidating !
Here is a picture of the 3.5 inch 480x320 display. Hard to shoot, much interference with my phone camera. Applied a tiny dose of denoising in Photoshop to mask that.
regards, Photoncatcher
You just select the appropriate define e.g.
//#define USE_TFT_LIB 0xA9341 // e.g. Adafruit_ILI9341
#define USE_TFT_LIB 0x00000 // e.g. Parallel MCUFRIEND_kbv
MCUFRIEND_kbv will find the ID. Knows the dimensions are 320x480. i.e. PORTRAIT
You could edit the TFT_BEGIN() macro to set the rotation to LANDSCAPE.
From memory, it will draw the background correctly to match the geometry.
David.
@photoncatcher,
My apologies. MCUFRIEND_kbv and any GFX library "knows" the lcd.width() and lcd.height() but the animation dimensions are set by the SCR_WD and SCR_HT defines.
I had to alter USE_TFT_LIB, SCR_WD, SCR_HT defines to run on my Blue ST7796S Shield.
Since you appear to have an ILI9486 display, please can you report to this message about Blue 9486 Shield with Mega2560
David.