本來這系列都計畫用SeeedStduio Grove系列產品做的,但是 Grove 系列沒推出較高解析度的LCM,在希望友直接顯示的實驗下只好選用其他廠家的LCM模組。
     Adafruit 2.4" TFT 附帶沒編碼過的電阻式觸控,面板解析度為 240 X 320 對角 2.4英吋,主控IC 是ILI 9341 可用SPI或8Bit傳送資料,資料線和電源是3.3V或5V都可(一般外面買的ILI3941 LCM不只電源要求3.3V就連信號也要3.3V。
Adafruit 最大的特點就是包裝就是隨便綑一綑。
內容物就是一片LCM一個排針。
LCM 排針一邊是給8Bit資料傳輸用一邊是給SPI資料傳輸用,為了減少接腳就選用SPI焊接。
要用SPI傳輸LCM背後IM1.IM2.IM3 要用焊錫短路。
再來就接線
LCM  RST   >>  D5
LCM  DC     >>  D6
LCM  CS      >>  D7
LCM  MOSI  >> D8
LCM  MISO  >> D9
LCM  CLK    >>  D10
LCM  Y+       >>  A3 
LCM  X-        >>  A2 
LCM  Y-         >>  D3 
LCM  X-        >>  D4 
到這下載需要的 Library解壓縮後放在Arduino目錄下的\libraries\。
https://github.com/adafruit/Touch-Screen-Library
https://github.com/adafruit/Adafruit_ILI9341
https://github.com/adafruit/Adafruit-GFX-Library
  開啟Arduino 輸入以下程式碼。
//This example implements a simple slidi。ng On/Off button. The example
// demonstrates drawing and touch operations.
//
//Thanks to Adafruit forums member Asteroid for the original sketch!
//
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#include <TouchScreen.h>
//觸控 X+ X- Y+ Y- pins
#define YP A3  // 只可以使用類比輸入 An !
#define XM A2  // 只可以使用類比輸入 An !
#define YM 3   //數位 I/O
#define XP 4   //數位 I/O
//觸控面板校正原始資料
#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940
#define MINPRESSURE 10
#define MAXPRESSURE 1000
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
#define TFT_RST   5
#define TFT_DC    6
#define TFT_CS    7
#define TFT_MOSI  8
#define TFT_MISO  9
#define TFT_CLK   10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
boolean RecordOn = false;
#define FRAME_X 70
#define FRAME_Y 80
#define FRAME_W 200
#define FRAME_H 100
#define REDBUTTON_X FRAME_X
#define REDBUTTON_Y FRAME_Y
#define REDBUTTON_W (FRAME_W/2)
#define REDBUTTON_H FRAME_H
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
#define GREENBUTTON_Y FRAME_Y
#define GREENBUTTON_W (FRAME_W/2)
#define GREENBUTTON_H FRAME_H
void drawFrame()
{
  tft.drawRect(FRAME_X, FRAME_Y, FRAME_W, FRAME_H, ILI9341_BLACK);
}
void redBtn()
{
  tft.fillRect(REDBUTTON_X, REDBUTTON_Y, REDBUTTON_W, REDBUTTON_H, ILI9341_RED);
  tft.fillRect(GREENBUTTON_X, GREENBUTTON_Y, GREENBUTTON_W, GREENBUTTON_H, ILI9341_BLUE);
  drawFrame();
  tft.setCursor(GREENBUTTON_X + 6 , GREENBUTTON_Y + (GREENBUTTON_H/2));
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(5);
  tft.println("ON");
  RecordOn = false;
}
void greenBtn()
{
  tft.fillRect(GREENBUTTON_X, GREENBUTTON_Y, GREENBUTTON_W, GREENBUTTON_H, ILI9341_GREEN);
  tft.fillRect(REDBUTTON_X, REDBUTTON_Y, REDBUTTON_W, REDBUTTON_H, ILI9341_BLUE);
  drawFrame();
  tft.setCursor(REDBUTTON_X + 6 , REDBUTTON_Y + (REDBUTTON_H/2));
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(5);
  tft.println("OFF");
  RecordOn = true;
}
void setup(void)
{
 pinMode(13, OUTPUT);
  tft.begin();
  tft.fillScreen(ILI9341_BLACK);
  // origin = left,top landscape (USB left upper)
  tft.setRotation(1);
  redBtn();
}
void loop()
{
   // Retrieve a point 
  TSPoint p = ts.getPoint();
  // See if there's any  touch data for us
  if (p.z > MINPRESSURE && p.z < MAXPRESSURE)
  { 
    // Scale using the calibration #'s
    // and rotate coordinate system
    p.x = map(p.x, TS_MINY, TS_MAXY, 0, tft.height());
    p.y = map(p.y, TS_MINX, TS_MAXX, 0, tft.width());
    int y = tft.height() - p.x;
    int x = p.y;
    if (RecordOn)
    {
      if((x > REDBUTTON_X) && (x < (REDBUTTON_X + REDBUTTON_W))) {
        if ((y > REDBUTTON_Y) && (y <= (REDBUTTON_Y + REDBUTTON_H))) {
           digitalWrite(13, LOW); 
          redBtn();
        }
      }
    }
    else //Record is off (RecordOn == false)
    {
      if((x > GREENBUTTON_X) && (x < (GREENBUTTON_X + GREENBUTTON_W))) {
        if ((y > GREENBUTTON_Y) && (y <= (GREENBUTTON_Y + GREENBUTTON_H))) {
           digitalWrite(13, HIGH);
          greenBtn();
        }
      }
    }
     } 
}
按上傳LCM就會顯示ON綠燈時LinkIt Smart 7688 Duo 版上的D13LED就會亮,按一下LCM的OFF。
    當紅燈亮起時LinkIt Smart 7688 Duo 版上的D13LED就會熄滅。再按一下LCM的 ON LCM就會顯示綠燈 LinkIt Smart 7688 Duo 版上的D13LED就會亮。
參考資料:https://www.adafruit.com/