Components and supplies
Solderless Breadboard Full Size
Resistor 1k ohm
DSD TECH 1.8 Inch TFT LCD Display Module with SD
Breadboard (generic)
Resistor 2.21k ohm
Flash Memory Card, SD Card
Arduino UNO
Project description
Code
Rose BMP Demo
arduino
1/* 2Rose BMP Demo 3by KodiakBart, Nov 2019 4Designed for the DSD 5 Tech 1.8" TFT screen and Adafruit drivers 6To allow simultaneous screen and card 7 reader functions, 8use hardware SPI, not software SPI 9(although pins 8 and 10 9 can be swapped) 11The pin breakout DSD Tech 1.8" TFT screen is as follows: 12 13 VCC........5V 14 GND........GND 15 GND........ 16 NC......... 17 NC......... 18 19 NC......... 20 CLK........13 (or SCK) 21 SDA........11 (or MOSI) 22 RS.........9 23 (or DC) 24 RST........8 (or RESET) 25 CS.........10 (or SS) 26Solder a four-pin 27 header to the SD connections on 28the DSD Tech 1.8" TFT screen 29 SD_MISO....12 30 31 SD_SCK.....13 (connected to screen CLK above) 32 SD_MOSI....11 (connected to screen 33 MOSI above) 34 SD_CS......4 35The SD card will work if it is 2G or less and formatted 36 as FAT (FAT16) 37To fit on the screen, all image files on the card must be pre-sized 38 39to 160 by 128 pixels or less and must be 24-bit RGB BMPs 40The BMP file names 41 must be no longer than 8 characters, 42however, when using many BMP files, the 43 file names will eat up memory, 44so use two-letter names 45*/ 46// Libraries 47 used 48#include <Adafruit_GFX.h> // Core graphics library 49#include 50 <Adafruit_ST7735.h> // Hardware-specific library 51#include <SdFat.h> // 52 SD card & FAT filesystem library 53#include <Adafruit_SPIFlash.h> // SPI / 54 QSPI flash library 55#include <Adafruit_ImageReader.h> // Image-reading functions 56// 57 Set SPI constants 58#define SD_CS 4 // SD card select pin 59#define TFT_CS 60 10 // TFT select pin 61#define TFT_DC 9 // TFT display/command pin 62#define 63 TFT_RST 8 // Or set to -1 and connect to Arduino RESET pin 64// Set SD speed 65 constant in Mhz (maybe try 10 if 4 does not work) 66#define MYSDMHZ 4 // For 67 SD.begin() below 68// This is required 69SdFat SD; 70// Create a card reader 71 object 72Adafruit_ImageReader myReader(SD); 73// Create a screen object 74Adafruit_ST7735 75 myTft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); 76// Create an image object for 77 loading into RAM 78Adafruit_Image myImage; 79void setup(void) { 80 // Init a 81 variable to hold the status from image-reading functions 82 ImageReturnCode myStat; 83 84 // Initialize the TFT screen 85 myTft.initR(INITR_BLACKTAB); 86 // Rotation 87 can be portrait (0 or 2) or landscape 88 // Set TFT rotation to landscape (could 89 be 3, but upside down) 90 myTft.setRotation(1); 91 // Clear screen to green to 92 indicate that the screen works 93 myTft.fillScreen(0x1F42); 94 // Pause for dramatic 95 effect 96 delay (1000); 97 // Initialize the card reader 98 // Note: Some breakouts 99 may require 10 MHz 100 if(!SD.begin(SD_CS, SD_SCK_MHZ(MYSDMHZ))) { 101 for(;;); 102 // Fatal error, do not continue 103 } 104 // Draw the picture called "ro.bmp" 105 (with "/" root directory indicator 106 // found on the root directory of the cared 107 reader) 108 // at location 0,0 (top left corner of the screen) 109 myStat = myReader.drawBMP("/ro.bmp", 110 myTft, 0, 0); 111 // Pause again 112 delay (3000); 113 // Clear the screen to black 114 115 myTft.fillScreen(0x0000); 116} 117void loop() { 118}
Rose BMP Demo
arduino
1/* 2Rose BMP Demo 3by KodiakBart, Nov 2019 4Designed for the DSD Tech 1.8" TFT screen and Adafruit drivers 5To allow simultaneous screen and card reader functions, 6use hardware SPI, not software SPI 7(although pins 8 and 9 can be swapped) 8The pin breakout DSD Tech 1.8" TFT screen is as follows: 9 VCC........5V 10 GND........GND 11 GND........ 12 NC......... 13 NC......... 14 NC......... 15 CLK........13 (or SCK) 16 SDA........11 (or MOSI) 17 RS.........9 (or DC) 18 RST........8 (or RESET) 19 CS.........10 (or SS) 20Solder a four-pin header to the SD connections on 21the DSD Tech 1.8" TFT screen 22 SD_MISO....12 23 SD_SCK.....13 (connected to screen CLK above) 24 SD_MOSI....11 (connected to screen MOSI above) 25 SD_CS......4 26The SD card will work if it is 2G or less and formatted as FAT (FAT16) 27To fit on the screen, all image files on the card must be pre-sized 28to 160 by 128 pixels or less and must be 24-bit RGB BMPs 29The BMP file names must be no longer than 8 characters, 30however, when using many BMP files, the file names will eat up memory, 31so use two-letter names 32*/ 33// Libraries used 34#include <Adafruit_GFX.h> // Core graphics library 35#include <Adafruit_ST7735.h> // Hardware-specific library 36#include <SdFat.h> // SD card & FAT filesystem library 37#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library 38#include <Adafruit_ImageReader.h> // Image-reading functions 39// Set SPI constants 40#define SD_CS 4 // SD card select pin 41#define TFT_CS 10 // TFT select pin 42#define TFT_DC 9 // TFT display/command pin 43#define TFT_RST 8 // Or set to -1 and connect to Arduino RESET pin 44// Set SD speed constant in Mhz (maybe try 10 if 4 does not work) 45#define MYSDMHZ 4 // For SD.begin() below 46// This is required 47SdFat SD; 48// Create a card reader object 49Adafruit_ImageReader myReader(SD); 50// Create a screen object 51Adafruit_ST7735 myTft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); 52// Create an image object for loading into RAM 53Adafruit_Image myImage; 54void setup(void) { 55 // Init a variable to hold the status from image-reading functions 56 ImageReturnCode myStat; 57 // Initialize the TFT screen 58 myTft.initR(INITR_BLACKTAB); 59 // Rotation can be portrait (0 or 2) or landscape 60 // Set TFT rotation to landscape (could be 3, but upside down) 61 myTft.setRotation(1); 62 // Clear screen to green to indicate that the screen works 63 myTft.fillScreen(0x1F42); 64 // Pause for dramatic effect 65 delay (1000); 66 // Initialize the card reader 67 // Note: Some breakouts may require 10 MHz 68 if(!SD.begin(SD_CS, SD_SCK_MHZ(MYSDMHZ))) { 69 for(;;); // Fatal error, do not continue 70 } 71 // Draw the picture called "ro.bmp" (with "/" root directory indicator 72 // found on the root directory of the cared reader) 73 // at location 0,0 (top left corner of the screen) 74 myStat = myReader.drawBMP("/ro.bmp", myTft, 0, 0); 75 // Pause again 76 delay (3000); 77 // Clear the screen to black 78 myTft.fillScreen(0x0000); 79} 80void loop() { 81}
Downloadable files
Rose BMP Demo
My first try at Fritzing! I hope it is accurate.
Rose BMP Demo
Comments
Only logged in users can leave comments
KodiakBart
0 Followers
•0 Projects
0