【2.8寸TFT LCD液晶触摸屏模块试用体验】图形测试

  • wildmonkey
  • LV4工程师
  • |      2018-05-11 23:10:22
  • 浏览量 927
  • 回复:0
硬件接法参考上面一个帖子 触摸屏的D0-D7接STM32F103C8T6的A0-A7 触摸屏的RD WR RS CS RST接STM32F103C8T6的PB4 PB5 PB6 PB7 PB8 触摸屏Pin24 Pin26 Pin23分别连接STM32F103C8T6的3.3 G 3.3 软件方面打开Arduino IDE,输入下面
#include 

#include 

#include "Adafruit_ILI9341_8bit_STM.h"



Adafruit_ILI9341_8bit_STM tft = Adafruit_ILI9341_8bit_STM();



int nFrames = 100;    // higher number, slower full-cycle annimation



void setup() {



  tft.begin();

  tft.fillScreen(ILI9341_BLACK);

}





void loop(void) {

  

 

  for (int frame=0; frame < nFrames; frame++)

  {

    HariChord(frame);

  }



  tft.fillScreen(ILI9341_BLACK);



  for (int frame=(nFrames-1); frame >= 0; frame--)

  {

    HariChord(frame);

  }



  tft.fillScreen(ILI9341_BLACK);

}



void HariChord(int frame)

{

  static boolean flipflop = true;

  flipflop = !flipflop;

  int n = 7;

  int r = frame * 120 / nFrames;    // half smaller of 240 or 320

  float rot = frame * 2*PI / nFrames;

  for (int i=0; i<(n-1); i++)

  {

    float a = rot + i * 2*PI / n;

    int x1 = 120 + cos(a) * r;    // half 240

    int y1 = 160 + sin(a) * r;    // half 320

    for (int j=i+1; j
烧写运行如下
  • 0
  • 收藏
  • 举报
  • 分享
我来回复

登录后可评论,请 登录注册

所有回答 数量:0
x
收藏成功!点击 我的收藏 查看收藏的全部帖子

上海固越电子科技有限公司 版权所有©       投诉、举报邮箱:contact@icxbk.com       客服、投诉、举报电话:021-31029100-9104

经营增值电信业务试点批复:沪通信管自贸[2019]24号 出版物经营许可证:新出发沪批字第Y8445号

沪ICP备18038102号  沪公网安备 31011702004806号 |营业执照