Go Down

Topic: How to create an apps using VM800C35A board with Arduino? (Read 62 times) previous topic - next topic

AzieRamlan

May 08, 2019, 04:52 am Last Edit: May 08, 2019, 05:05 am by AzieRamlan Reason: Add a link to component I use
Hello! I need  a really desperate help for my programming problem.

I have Arduino Mega2560 original board, DS3231 module and FTDI Chip Board which is  VM800C35A attach with 3.5" LCD.

This is the image of FTDI Chip Board I have
https://my.rs-online.com/web/p/products/7877068/?grossPrice=Y&cm_mmc=MY-PLA-DS3A-_-google-_-PLA_MY_EN_Catch_All-_-Fusion-_-PRODUCT_GROUP&matchtype=&pla-468790558708&gclid=CjwKCAjw2cTmBRAVEiwA8YMgzWU_yX7k0UafsL1SMdxbJAsbmCP4zJ_3FsVftdSHa-axMq-HO8oY3hoC6XAQAvD_BwE&gclsrc=aw.ds

This is the image of DS3231 module
https://www.lazada.com.my/products/ybc-1510pcs-precision-real-time-clock-memory-module-iic-module-board-ds3231-at24c32-i488826678-s853210628.html?ef_id=CjwKCAjw2cTmBRAVEiwA8YMgzTvCUsjl3EBLIKpU9tPFM9_PI-6KnI-MTU8JWCIwpX_AthZ5u3SqfhoCuIgQAvD_BwE:G:s&s_kwcid=AL!3150!3!244160057898!!!u!296303633664!&exlaz=d_1:mm_150050845_51350205_2010350205::12:1032211143!54400014687!!!pla-296303633664!c!296303633664!853210628!128329398&gclid=CjwKCAjw2cTmBRAVEiwA8YMgzTvCUsjl3EBLIKpU9tPFM9_PI-6KnI-MTU8JWCIwpX_AthZ5u3SqfhoCuIgQAvD_BwE

I have play around with all the hardware and I can display time from DS3231 module on the screen. There no problem to program the LCD for a simple display.

Can someone guide me how to create a  touchscreen button on a menu display? I have calibrate the touchscreen but it seen like the touchscreen are not accurate.

Here my code

Code: [Select]
#include <SPI.h>
#include <Wire.h>
#include <FT_VM800B35.h>
#include <DS3231.h>

DS3231 rtc(SDA, SCL);
Time t;

#define RAM_BACK 147580
static PROGMEM prog_uchar Back[] = {
  #include "Back.h"
};

#define RAM_NEXT 225380
static PROGMEM prog_uchar Next[] = {
  #include "Next.h"
};

FT800IMPL_SPI FTImpl(FT_CS_PIN, FT_PDN_PIN, FT_INT_PIN);

void Calibrate()
{
  FTImpl.DLStart();
  FTImpl.ClearColorRGB(255, 255, 255);  // ClearColorRGB(Red, Green, BLue) to set the background color
  FTImpl.Clear(1, 1, 1);  // Clear(ColorBuffer, StencilBuffer, TagBuffer)
  FTImpl.ColorRGB(0, 0, 0); // to set the text color
  FTImpl.Cmd_Text(160, 100, 26, FT_OPT_CENTER, "SILA TEKAN PADA");  // Cmd_Text(x-coordinate, y-coordinate, font, options, text in string)
  FTImpl.Cmd_Text(160, 115, 26, FT_OPT_CENTER, "BUTANG DI PAPARAN");
  FTImpl.Cmd_Calibrate(0);  // to calibrate the touchscreen value
  FTImpl.DLEnd();
  FTImpl.Finish();
}

int tag = 0;
int tagValue = 0;
int pressed = 0;

void FirstDisplay()
{
  t = rtc.getTime();
  
  FTImpl.DLStart();
  FTImpl.ClearColorRGB(255, 255, 255);
  FTImpl.Clear(1, 1, 1);
  FTImpl.Tag(2);
  FTImpl.Begin(FT_BITMAPS); // Next
  FTImpl.Vertex2ii(270, 190, 12, 0);
  FTImpl.End();

  FTImpl.ColorRGB(0, 0, 0);
  FTImpl.Cmd_Clock(70, 50, 36, FT_OPT_FLAT|FT_OPT_NOBACK, t.hour, t.min, t.sec, millis);  // Cmd_Clock(x-coordinate, y-coordinate, radius, options, hours, minutes, seconds, milliseconds)
  FTImpl.Cmd_Text(70, 110, 31, FT_OPT_CENTER, rtc.getTimeStr(1));
  FTImpl.Cmd_Text(70, 160, 28, FT_OPT_CENTER, rtc.getDateStr());
  FTImpl.Cmd_Text(70, 200, 28, FT_OPT_CENTER, rtc.getDOWStr());
    
  FTImpl.DLEnd();
  FTImpl.Finish();
}

void ThirdDisplay()
{
  FTImpl.DLStart();
  FTImpl.ClearColorRGB(255, 255, 255);
  FTImpl.Clear(1, 1, 1);
 
  FTImpl.ColorRGB(0, 0, 0);
  FTImpl.Cmd_FGColor(16744255);
  FTImpl.Cmd_Button(120, 110, 145, 35, 27, 0, "TUTORIAL");
  FTImpl.Cmd_Button(120, 155, 145, 35, 27, 0, "EXERCISE");
  FTImpl.Cmd_Button(120, 200, 145, 35, 27, 0, "RECORD");
    
  FTImpl.DLEnd();
  FTImpl.Finish();
}

void setup()
{
  rtc.begin();

  FTImpl.Init(FT_DISPLAY_RESOLUTION);
  FTImpl.SetDisplayEnablePin(FT_DISPENABLE_PIN);
  FTImpl.SetAudioEnablePin(FT_AUDIOENABLE_PIN);
  FTImpl.DisplayOn();
  FTImpl.AudioOn();
  
  FTImpl.DLStart();

  FTImpl.BitmapHandle(12);
  FTImpl.BitmapSource(225380);  // Next
  FTImpl.BitmapLayout(FT_RGB565, 100, 50);
  FTImpl.BitmapSize(FT_NEAREST, FT_BORDER, FT_BORDER, 50, 50);
  FTImpl.DLEnd();
  FTImpl.Finish();
}

void loop()
{
  sTagXY sTagxy;
  
  FTImpl.GetTagXY(sTagxy);
  tagValue = sTagxy.tag;

  if(tagValue == 2 && tag == 2)pressed = 2;
  
  switch(pressed)
  {
    case 0:
    FirstDisplay();
    break;

    case 2:
    ThirdDisplay();
    break;
  }
  tag = tagValue;
  
}

Go Up