“Tft.drawLine()”的版本间的差异

来自Microduino Wikipedia
跳转至: 导航搜索
(创建页面,内容为“<pre style="color:green"> drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) </pre> *'''作用''':<br> 在TFT屏幕上画出一条任意角度...”)
 
第1行: 第1行:
 
<pre style="color:green">
 
<pre style="color:green">
drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
+
tft.drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
</pre>
 
</pre>
  

2016年7月13日 (三) 05:38的版本

tft.drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
  • 作用:

在TFT屏幕上画出一条任意角度的直线


  • 参数:

x0:起始点x轴坐标

y0:起始点y轴坐标

x1:终止点x轴坐标

y1:终止点y轴坐标

color:线的颜色


  • 例子:
#define sclk 13
#define mosi 11
#define cs   5
#define dc   4
#define rst  -1  // you can also connect this to the Arduino reset

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>

#if defined(__SAM3X8E__)
    #undef __FlashStringHelper::F(string_literal)
    #define F(string_literal) string_literal
#endif

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);

void setup(void) {
  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
  tft.fillScreen(ST7735_BLACK);
  tft.drawLine(10, 20, 80, 150, ST7735_GREEN);
}

void loop() {  }


[返回TFT_ST7735语法手册]