YMMV

* your mileage may vary

Wednesday, 24 February 2016

Arduino Uno with Sainsmart 32 (TFT_QVT)

Basic Hello World with 320x240 TFT on Arduino Uno - used as basis to test for my BBB.  Full credit to http://www.craigandheather.net/docs/ContemplatorArticle.pdf
Pin Mapping


Note it is required to load the UTFT library beforehand.


Stripped down program (just the basics to test the screen)


//////////////

#include <memorysaver.h>
#include <UTFT.h>

#include <memorysaver.h>
#include <UTFT.h>

// UTFT_Demo_320x240
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of how to use most of the functions
// of the library with a supported display modules.
//
// This demo was made for modules with a screen resolution
// of 320x240 pixels.
//
// This program requires the UTFT library.
//

#include <setjmp.h>
#include <UTFT.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];

// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------
// Arduino Uno / 2009:
// -------------------
// Standard Arduino Uno/2009 shield            : <display model>,A5,A4,A3,A2
// DisplayModule Arduino Uno TFT shield        : <display model>,A5,A4,A3,A2
//
// Arduino Mega:
// -------------------
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Mega      : <display model>,38,39,40,41
//
// Remember to change the model parameter to suit your display module!
//UTFT myGLCD(SSD1289,38,39,40,41);

UTFT myGLCD(SSD1289, 19, 18, 17, 16, LANDSCAPE);
void setup()
{
   // All analog lines to output for LCD display (on Uno)
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);
  myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);
  myGLCD.clrScr();

  myGLCD.setColor(255,255,0);
  myGLCD.clrScr();
  myGLCD.print("hello world", CENTER, 10);


}

void loop()
{

// Clear the screen and draw the frame


}




No comments:

Post a Comment