Looking for ways to animate gifs on 1.8" tft LCD using Teensy 3.1

Status
Not open for further replies.
Hey folks!

Complete noob when it comes to these things, and I am even worse where coding is concerned. So here is my question: Has anyone made, or have an idea how to play animated gifs on a 1.8" tft display (Tontec 1.8" TFT Color LCD Display Module SPI Interface MicroSD using ST7735R driver).

The project: Star Trek: The Next Generation Tricorder prop

Needs: A working LCD display of various home brewed LCARS gifs to give more realism to the prop. (Maybe sequenced BMP images?)

I have been able to get display demos running from an Ardunio Nano, my hope being that I could get the code down and working, then transfer the majority of it over to the Teensy 3.1 (as my power source is a 3.7v LiPo battery), Arduino was out as it takes a 5v power source which would blow up my tricorder electronics, AND is much slower than the teensy. So, anyone out there that can help a newbie with this? I'd love to say that I could do this on my own, but I just don't have the technical background to do much more than copy paste at the moment.
Thanks!

-Jimmypop Fiftyseven
 
Probably the path of least resistance would involve converting each frame to a separate .BMP file and placing them all on a SD card. There's already example code which reads a BMP using the SD library and puts it on the screen.

If that turns out to be too slow... post an update here with your progress. I have a couple ideas for speeding it up, involving only a little hacking on the library.

A much harder, but really awesome way would involve porting the classic GIF code to Teensy. But it's complicated, especially supporting animations which utilize transparency between frames. I'd try the sequence of BMPs first...
 
I'll give that a try when I get off work. Presently I'm just trying to display the first bmp in my sequence to see if I can get it to display what I want, but got an interesting result of random pixel splatter (guessing my bmp has to many colors for this display?). I don't have access to the sketch I am using at work, so I'll get a copy of that in here as soon as I can. I'm using a Ardunio Nano knockoff (SainSmart Nano v3.0).

 
Sorry it took me so long to get back to this post. Work caught up with me this week. So still having issues just displaying a single bmp, let alone a sequence. I am using the "graphicstest" which I have gotten to work, but still getting pixel splatter for my 24bit bmp. This is the sketch I am using trying to get this working:

/*

Arduino TFT Bitmap Logo example

This example reads an image file from a micro-SD card
and draws it on the screen, at random locations.

In this sketch, the Arduino logo is read from a micro-SD card.
There is a .bmp file included with this sketch.
- open the sketch folder (Ctrl-K or Cmd-K)
- copy the "arduino.bmp" file to a micro-SD
- put the SD into the SD slot of the Arduino TFT module.

This example code is in the public domain.

Created 19 April 2013 by Enrico Gueli

http://arduino.cc/en/Tutorial/TFTBitmapLogo

*/

// include the necessary libraries
#include <SPI.h>
#include <SD.h>
#include <TFT.h> // Arduino LCD library

// Init pins
#define sclk 13
#define mosi 11
#define lcd_cs 10
#define sd_cs 4
#define dc 9
#define rst 8

// pin definition for the Leonardo
//#define sd_cs 8
//#define lcd_cs 7
//#define dc 0
//#define rst 1

TFT TFTscreen = TFT(lcd_cs, dc, rst);

// this variable represents the image to be drawn on screen
PImage logo;

void setup() {

// try to access the SD card. If that fails (e.g.
// no card present), the setup process will stop.
Serial.print(F("Initializing SD card..."));
if (!SD.begin(sd_cs)) {
Serial.println(F("failed!"));
return;
}
Serial.println(F("OK!"));

// initialize and clear the GLCD screen
TFTscreen.begin();
TFTscreen.background(255, 255, 255);

// now that the SD card can be accessed, try to load the
// image file.
logo = TFTscreen.loadImage("LCARS-Rotation-s30000.bmp");
if (!logo.isValid()) {
Serial.println(F("error while loading arduino.bmp"));
}
}

void loop() {
// don't do anything if the image wasn't loaded correctly.
if (logo.isValid() == false) {
return;
}

Serial.println(F("drawing image"));

// get a random location where to draw the image.
// To avoid the image to be draw outside the screen,
// take into account the image size.
int x = random(TFTscreen.width() - logo.width());
int y = random(TFTscreen.height() - logo.height());

// draw the image to the screen
TFTscreen.image(logo, x, y);

// wait a little bit before drawing again
delay(1500);
}
 
Code is easier to read and cut/paste using the [C0DE][/C0DE] blocking (spell CODE with O not a 0_ZERO). It is a button on ADVANCED edit, but I usually click the QUOTE button and just rewrite both parts to CODE
 
I still haven't been able to get this to work. I have fiddled with formats, color palates, and 16-32 bit images. Reformatting my comp lost all the work I had done. However I refuse to finish the Star Trek prop without a working and animated screen. Driving me nuts it's been this long and I have 0% progress where the screen is concerned. I can't find heads or tails of how folks use, or even if they use, the teensy 3.1 to drive animated gifs on a tft LCD. Very frustrating with my lack of programing knowledge.
 
Thanks for the reply. The files are not presently sharable, they are housed on my personal comp at home. I can share them after work. Just some LCARs gifs of various screens.
 
Status
Not open for further replies.
Back
Top