#include<SPI.h>#include<TFT.h> // Arduino LCD library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.stroke(255,255,255);// turn off fill coloring
screen.noFill();// draw a rectangle in the center of screen
screen.line(screen.width()/2-5,screen.height()/2-5,10,10);}voidloop(){}
EsploraTFT
名称
EsploraTFT
説明
Arduino Esploraボードを使うときに生成される、TFTクラスのインスタンスの名称。
書式
EsploraTFT;
引数
なし。
戻り値
なし。
使用例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<Esplora.h>#include<SPI.h>#include<TFT.h> // Arduino LCD libraryvoidsetup(){// initialize the screen
EsploraTFT.begin();// make the background white
EsploraTFT.background(255,255,255);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino LCD library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background white
screen.background(255,255,255);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino LCD library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background white
screen.background(255,255,255);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino LCD library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.stroke(255,255,255);// draw a box with a white outline in the middle of the screen
screen.rect(screen.width()/2+10,screen.height()/2+10,screen.width()/2-10,screen.height()/2-10);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// turn the stroke off
screen.noStroke();// set the fill color to white
screen.fill(255,255,255);// draw a rectangle in the center of screen
screen.line(screen.width()/2-5,screen.height()/2-5,10,10);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.fill(255,255,255);// draw a white box in the screen center
screen.rect(screen.width()/2+10,screen.height()/2+10,screen.width()/2-10,screen.height()/2-10);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// turn the fill off
screen.noFill();// set the stroke color to white
screen.stroke(255,255,255);// draw a rectangle in the center of screen
screen.line(screen.width()/2-5,screen.height()/2-5,10,10);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the text color to white
screen.stroke(255,255,255);// write text to the screen in the top left corner
screen.text("Testing!",0,0);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.fill(255,255,255);// default text size
screen.setTextSize(1);// write text to the screen in the top left corner
screen.text("Testing!",0,0);// increase text size
screen.setTextSize(5);// write text to the screen below
screen.text("BIG!",0,10);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.fill(255,255,255);// draw a pixel in the screen's center
screen.point(screen.width()/2,screen.height()/2);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.stroke(255,255,255);// draw a diagonal line across the screen's center
screen.line(0,0,160,124);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.stroke(255,255,255);// set the fill color to grey
screen.fill(127,127,127);// draw a rectangle in the center of screen
screen.rect(screen.width()/2-5,screen.height()/2-5,10,10);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.stroke(255,255,255);// set the fill color to grey
screen.fill(127,127,127);// draw a rectangle in the center of screen
screen.line(screen.width()/2-5,screen.height()/2-5,10,10);}voidloop(){}
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.stroke(255,255,255);// set the fill color to grey
screen.fill(127,127,127);// draw a rectangle in the center of screen
screen.line(screen.width()/2-5,screen.height()/2-5,10,10);}voidloop(){}
circle()
名称
TFT.circle()
説明
スクリーンに円を描く。
円は、その中心を指定して描かれる。このため、直径は常に奇数になる。
書式
void Adafruit_GFX::circle(int16_t x, int16_t y, int16_t r);
#include<SPI.h>#include<TFT.h> // Arduino TFT library#define cs 10
#define dc 9
#define rst 8
TFTscreen=TFT(cs,dc,rst);voidsetup(){// initialize the screen
screen.begin();// make the background black
screen.background(0,0,0);// set the stroke color to white
screen.stroke(255,255,255);// set the fill color to grey
screen.fill(127,127,127);// draw a circle in the center of screen
screen.circle(screen.width()/2,screen.height()/2,10);}voidloop(){}
// this example looks for a file named "logo.bmp"
// on the SD card, and renders it to the screen
#include<Esplora.h>#include<SPI.h>#include<SD.h>#include<TFT.h> // Arduino TFT library#define SD_CS 8 // Chip select line for SD card in Esplora
PImagelogo;voidsetup(){// initialize the screen
EsploraTFT.begin();// initialize the SD card
SD.begin(SD_CS);// set the background the black
EsploraTFT.background(0,0,0);// load the image into the named instance of PImage
logo=EsploraTFT.loadImage("arduino.bmp");// if it is a valid image file, turn the Esplora's LED green
if(logo.isValid()){Esplora.writeGreen(255);}else{// if it is not valid, turn the LED red
Esplora.writeRed(255);}// draw the image on the screen starting at the top left corner
EsploraTFT.image(logo,0,0);}voidloop(){}
// this example looks for a file named "logo.bmp"
// on the SD card, and renders it to the screen
#include<Esplora.h>#include<SD.h>#include<SPI.h>#include<TFT.h> // Arduino TFT library#define SD_CS 8 // Chip select line for SD card in Esplora
PImagelogo;voidsetup(){// initialize the screen
EsploraTFT.begin();// initialize the SD card
SD.begin(SD_CS);// set the background the black
EsploraTFT.background(0,0,0);// load the image into the named instance of PImage
logo=EsploraTFT.loadImage("arduino.bmp");// if it is a valid image file, turn the Esplora's LED green
if(logo.isValid()){Esplora.writeGreen(255);}else{// if it is not valid, turn the LED red
Esplora.writeRed(255);}// draw the image on the screen starting at the top left corner
EsploraTFT.image(logo,0,0);}voidloop(){}
// this example looks for a file named "logo.bmp"
// on the SD card, and renders it to the screen
#include<Esplora.h>#include<SD.h>#include<SPI.h>#include<TFT.h> // Arduino TFT library#define SD_CS 8 // Chip select line for SD card in Esplora
PImagelogo;voidsetup(){// initialize the screen
EsploraTFT.begin();// initialize the SD card
SD.begin(SD_CS);// set the background the black
EsploraTFT.background(0,0,0);// load the image into the named instance of PImage
logo=EsploraTFT.loadImage("arduino.bmp");// if it is a valid image file, turn the Esplora's LED green
if(logo.isValid()){Esplora.writeGreen(255);}else{// if it is not valid, turn the LED red
Esplora.writeRed(255);}// draw the image on the screen starting at the top left corner
EsploraTFT.image(logo,0,0);}voidloop(){}
// this example looks for a file named "logo.bmp"
// on the SD card, and renders it to the screen
#include<Esplora.h>#include<SD.h>#include<SPI.h>#include<TFT.h> // Arduino TFT library#define SD_CS 8 // Chip select line for SD card in Esplora
PImagelogo;voidsetup(){// initialize the screen
EsploraTFT.begin();// initialize the SD card
SD.begin(SD_CS);// set the background the black
EsploraTFT.background(0,0,0);// load the image into the named instance of PImage
logo=EsploraTFT.loadImage("arduino.bmp");// if it is a valid image file, turn the Esplora's LED green
if(logo.isValid()){Esplora.writeGreen(255);}else{// if it is not valid, turn the LED red
Esplora.writeRed(255);}}voidloop(){// randomly draw the image on screen
intx=random(EsploraTFT.width()-logo.width());inty=random(EsploraTFT.height()-logo.height());EsploraTFT.image(logo,x,y);delay(1500);}
// this example looks for a file named "logo.bmp"
// on the SD card, and renders it to the screen
#include<Esplora.h>#include<SD.h>#include<SPI.h>#include<TFT.h> // Arduino TFT library#define SD_CS 8 // Chip select line for SD card in Esplora
PImagelogo;voidsetup(){// initialize the screen
EsploraTFT.begin();// initialize the SD card
SD.begin(SD_CS);// set the background the black
EsploraTFT.background(0,0,0);// load the image into the named instance of PImage
logo=EsploraTFT.loadImage("arduino.bmp");// if it is a valid image file, turn the Esplora's LED green
if(logo.isValid()){Esplora.writeGreen(255);}else{// if it is not valid, turn the LED red
Esplora.writeRed(255);}// draw the image on the screen starting at the top left corner
EsploraTFT.image(logo,0,0);}voidloop(){}
// this example looks for a file named "logo.bmp"
// on the SD card, and renders it to the screen
#include<Esplora.h>#include<SD.h>#include<SPI.h>#include<TFT.h> // Arduino TFT library#define SD_CS 8 // Chip select line for SD card in Esplora
PImagelogo;voidsetup(){// initialize the screen
EsploraTFT.begin();// initialize the SD card
SD.begin(SD_CS);// set the background the black
EsploraTFT.background(0,0,0);// load the image into the named instance of PImage
logo=EsploraTFT.loadImage("arduino.bmp");// if it is a valid image file, turn the Esplora's LED green
if(logo.isValid()){Esplora.writeGreen(255);}else{// if it is not valid, turn the LED red
Esplora.writeRed(255);}}voidloop(){// randomly draw the image on screen
intx=random(EsploraTFT.width()-logo.width());inty=random(EsploraTFT.height()-logo.height());EsploraTFT.image(logo,x,y);delay(1500);}