Showing posts with label UTFT. Show all posts
Showing posts with label UTFT. Show all posts

Friday, June 17, 2016

Arduino Mega read string from Serial, display on 3.2" 480 x 320 TFT LCD Shield


Arduino example run on Mega 2560, read string from Serial port, and display on 3.2" 480 x 320 TFT LCD Shield usin UTFT library. The sting is limited to 30 characters on each line.


Mega_UTFT_SerialRead.ino
/*
 * Example run on Arduino Mega 2560 to read string from Serial,
 * then display on 3.2" 480 x 320 TFT LCD Shield
 * 
 * http://arduino-er.blogspot.com/search/label/3.2%22%20480%20x%20320%20TFT%20LCD%20Shield
*/

#include <UTFT.h>

extern uint8_t BigFont[];

UTFT myGLCD(CTE32HR,38,39,40,41);

const int NumOfRow = 20;
const int HeightOfRow = 16;
const int CharPerRow = 30;

String buffer[NumOfRow];

void setup()
{
  Serial.begin(57600);
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(0, 0, 0);

  myGLCD.setFont(BigFont);

  myGLCD.print("Open Serial Monitor,", LEFT, 0);
  myGLCD.print("to enter something.", LEFT, HeightOfRow);
  
  initBuffer();
}

void loop()
{
  String stringIn = Serial.readStringUntil('\n');
  Serial.print(".");
  if(!stringIn.equals("")){
    Serial.print("*");
    String stringToIns = stringIn.substring(0, CharPerRow);
    insert(stringToIns);
    Serial.println(stringToIns);
    printBuffer();
  }
  
}

void initBuffer(){
  for(int i=0; i<NumOfRow; i++){
    buffer[i] = "";
  }
}

void insert(String ins){
  for(int i=0; i<NumOfRow-1; i++){
    buffer[i] = buffer[i+1];
  }
  buffer[NumOfRow-1] = ins;
}

void printBuffer(){
  myGLCD.clrScr();
  for(int i=0; i<NumOfRow; i++){
    myGLCD.print(buffer[i], LEFT, i*HeightOfRow);
  }
}



Thursday, June 16, 2016

Arduino Mega Draw bitmap on 3.2" 480 x 320 TFT LCD Shield using UTFT

This post show how to draw bitmap on 3.2" 480 x 320 TFT LCD Shield using UTFT, run on Arduino Mega 2560.



Before start, you have to install UTFT library on your Arduino IDE.

Once installed, it's a program ImageConverter565.exe in the Tools directory under the library, used to convert image files to array in .c (.raw) format, can be loaded in our sketch.

This video show how:


Example code, MegaUTFTBitmap.ino
#include <UTFT.h>

UTFT myGLCD(CTE32HR,38,39,40,41);

extern unsigned int Arduinoer[];

void setup() {
  // put your setup code here, to run once:
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.drawBitmap(0, 0, 100, 100, Arduinoer);

}

void loop() {
  // put your main code here, to run repeatedly:

}

3.2" 480 x 320 TFT LCD Shield, install UTFT library and test with Arduino Mega 2560

It's 3.2" 480 x 320 TFT color screen support Arduino Mega 2560, named QDM320B.








According to the seller:

Overview
QD320DB16NT8357RA module is 3.2" TFT LCD with 262K color 480x320 resolutions.
The controller of this LCD module is HX8357B, it supports 16-wires DataBus interface. Moreover, this module includes the 5V -3.3V power conversion circuit and Level Level conversion circuit, This Module can Directly inserted into the Arduino Mega2560 Board, it also includes the SD card socket and SPI FLASH circuit.

Features

  • Support Arduino Mega2560 Directly inserted
  • With Full-angle IPS TFT panel
  • OnBorad level conversion chip for 5V/3.3V MCU
  • Compatible with 3.3/5V operation voltage level
  • Compatible with Arduino-Series development Board.
  • Compatible with UTFT / UTFT_Buttons /Utouch Library for arduino.
  • provided 12-examples with Arduino ,3-examples with STM32 
  • With SD Card Socket
  • With SPI FLASH circuit



This video show how to install UTFT library (from http://www.rinkydinkelectronics.com/) and test example on Arduino Mega 2560.


More examples:
Draw bitmap on 3.2" 480 x 320 TFT LCD Shield using UTFT
Arduino Mega read string from Serial, display on 3.2" 480 x 320 TFT LCD Shield