コード例 #1
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testlines(uint16_t color) {
    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=0; x < tft.width(); x+=6) {
        tft.drawLine(0, 0, x, tft.height()-1, color);
    }
    for (int16_t y=0; y < tft.height(); y+=6) {
        tft.drawLine(0, 0, tft.width()-1, y, color);
    }

    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=0; x < tft.width(); x+=6) {
        tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color);
    }
    for (int16_t y=0; y < tft.height(); y+=6) {
        tft.drawLine(tft.width()-1, 0, 0, y, color);
    }

    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=0; x < tft.width(); x+=6) {
        tft.drawLine(0, tft.height()-1, x, 0, color);
    }
    for (int16_t y=0; y < tft.height(); y+=6) {
        tft.drawLine(0, tft.height()-1, tft.width()-1, y, color);
    }

    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=0; x < tft.width(); x+=6) {
        tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color);
    }
    for (int16_t y=0; y < tft.height(); y+=6) {
        tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color);
    }
}
コード例 #2
0
ファイル: tron.cpp プロジェクト: tpavlek/arduitron
void drawGUI() {
    tft.fillScreen(ST7735_BLACK);
    tft.setCursor(0,70);
    dualPrint("Play a game?");
    dualPrint("<Press Joystick>");
    lcd_image_draw(&logoImage, &tft, 0, 0, 30, 10, 100, 50);
}
コード例 #3
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testfillrects(uint16_t color1, uint16_t color2) {
    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=tft.width()-1; x > 6; x-=6) {
        tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1);
        tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2);
    }
}
コード例 #4
0
ファイル: example.cpp プロジェクト: Trekky12/Adafruit_ST7735
void loop() {
    Serial.println("printing though!");
    tft.fillScreen(ST7735_BLACK);
    // tft.setCursor(0, 0);
    tft.setTextColor(ST7735_WHITE);
    tft.setTextWrap(true);
    // tft.setTextSize(3);
    // tft.setCursor(30, 3);
    tft.setFont(HERO_10);
    tft.drawRightString("OTTAWA",  3);

    tft.setFont(HERO_16);
    tft.setTextSize(2);
    // tft.setCursor(25, 20);
    tft.drawRightString("-1  C", 20);

    tft.setTextSize(1);
    // tft.setCursor(35, 60);
    tft.drawRightString("2:35 PM", 60);

    tft.drawFastHLine(0, 90, tft.width(), ST7735_CYAN);

    tft.setTextWrap(true);
    tft.setFont(CENTURY_8);
    tft.setTextSize(1);
    // tft.setCursor(0, tft.height()-65);
    int yPos = tft.drawString("Stay Hungry, Stay Foolish!",  0,tft.height()-65);
    tft.setTextColor(ST7735_CYAN);
    tft.drawRightString(" - Steve Jobs   ", yPos);
    tft.setTextColor(ST7735_MAGENTA);
    delay(5000);
}
コード例 #5
0
void setup() {
// start the spi bus
#ifdef hal_spi
  SPI.begin();
#endif
#ifdef hal_tft
  lcd.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
  lcd.fillScreen(ST7735_BLACK);
#endif
  // initialize serial port
  Serial.begin(9600);
  // leonardo - wait for connection
  while(!Serial) { }
#ifdef TwoWire_h
  // start the i2C bus
  Wire.begin();
#endif
#ifdef hal_raster
  Raster.start();
#endif
#ifdef hal_compass
  compass.start();
#endif
  // start the droid filesystem (now we have serial)
  droid.fs.start();
  // center the joystick
#ifdef hal_tft
  droid.joystick[0].center = 1024 - analogRead(A1);
  droid.joystick[1].center = analogRead(A2);
#endif
  // droid.joystick_center[0] = 1024 - analogRead(A1);
  // droid.joystick_center[1] = analogRead(A2);
}
コード例 #6
0
ファイル: tron.cpp プロジェクト: tpavlek/arduitron
void setup() {
    Serial.begin(9600);
    Serial1.begin(9600);
    tft.initR(INITR_REDTAB);
    randomSeed(analogRead(4));
    joystickXCentre = analogRead(JOYSTICK_MOVE_X_PIN) - 512;
    joystickYCentre = analogRead(JOYSTICK_MOVE_Y_PIN) - 512;
    pinMode(JOYSTICK_BUTTON_PIN, INPUT_PULLUP);
    pinMode(COUNTDOWN_START_RED_1, OUTPUT);
    pinMode(COUNTDOWN_START_RED_2, OUTPUT);
    pinMode(COUNTDOWN_MID_RED_1, OUTPUT);
    pinMode(COUNTDOWN_MID_RED_2, OUTPUT);
    pinMode(COUNTDOWN_GREEN, OUTPUT);
    tft.setRotation(1); //because our screen is nonstandard rotation
    player1.score = 0;
    player2.score = 0;
    if (!SD.begin(SD_CS)) {
        Serial.println("SD Init Failed");
        return;
    }
    if (!card.init(SPI_HALF_SPEED, SD_CS)) {
        Serial.println("Raw SD Init failed");
        while (1);
    }
    tft.fillScreen(ST7735_BLACK);
}
コード例 #7
0
ファイル: display.cpp プロジェクト: AgriVision/Teensy_SDR
void main_display(void) {
  tft.fillScreen(BLACK);
  tft.setFont(&FreeSans9pt7b);
  // Show mid screen tune position
  tft.drawFastVLine(80, 0, 60, RED);
  show_s_meter_layout();
}
コード例 #8
0
void init()
{
	spiffs_mount(); // Mount file system, in order to work with files

	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(true); // Allow debug output to serial

	//WifiStation.config(WIFI_SSID, WIFI_PWD);
	WifiStation.enable(false);
//	WifiAccessPoint.enable(false);

	debugf("Display start");
	startTime = millis();

	// Use this initializer if you're using a 1.8" TFT
	// tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab

	// Use this initializer (uncomment) if you're using a 1.44" TFT
	tft.initR(INITR_144GREENTAB);   // initialize a ST7735S chip, black tab

	tft.fillScreen(ST7735_BLACK);
	startTime = millis() - startTime;

	debugf("Initialized in %d ms\n", startTime);

	DemoScreenTimer.initializeMs(500, screen1).start(FALSE);

}
コード例 #9
0
void screen13() {
	startTime = millis();
	debugf("screen13: bmpDraw rotaton %d ms", millis() - startTime);
	tft.fillScreen(ST7735_BLACK); // Clear display
	tft.setRotation(tft.getRotation() + 1); // Inc rotation 90 degrees
	for (uint8_t i = 0; i < 4; i++)    // Draw 4 parrots
		bmpDraw(tft, "sming.bmp", tft.width() / 4 * i, tft.height() / 4 * i);
}
コード例 #10
0
void screen1() {
	startTime = millis();
    // large block of text
    tft.fillScreen(ST7735_BLACK);
    testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", ST7735_WHITE);
	debugf("screen1: testdrawtext %d ms", millis() - startTime);
	DemoScreenTimer.initializeMs(1000, screen2).start(FALSE);
}
コード例 #11
0
void screen8() {
	startTime = millis();
	tft.fillScreen(ST7735_BLACK);
	testfillcircles(10, ST7735_BLUE);
	testdrawcircles(10, ST7735_WHITE);
	debugf("screen8: testfillcircles %d ms", millis() - startTime);
	DemoScreenTimer.initializeMs(1000, screen9).start(FALSE);
}
コード例 #12
0
ファイル: tetris.cpp プロジェクト: askalburgi/Arduino_Tetris
void setup() {
	Serial.begin(9600);

	// initialise display
	tft.initR(INITR_BLACKTAB);
	tft.fillScreen(ST7735_BLACK);

	// initialise pins
	pinMode(leftPin, INPUT);
	pinMode(rightPin, INPUT);
	pinMode(turnPin, INPUT);
	
	// display splashscreen
	tft.setTextColor(ST7735_WHITE);
	tft.setTextWrap(true);
	
	tft.setCursor(34, 20);
	tft.println("WELCOME TO");
	
	tft.setCursor(45, 30);
	tft.println("~TETRIS");
	
	tft.setCursor(16, 50);
	tft.println("PRESS THE MIDDLE");
	
	tft.setCursor(18, 60);
	tft.println("BUTTON TO START");

	tft.setCursor(57, 110);
	tft.println("BY:");

	tft.setCursor(33, 120);
	tft.println("NICHOLAS LI");

	tft.setCursor(56, 130);
	tft.println("AND");

	tft.setCursor(24, 140);
	tft.println("ARJUN KALBURGI");

	// only continue if turnPin is pressed
	while(digitalRead(turnPin) == LOW) {}

	tft.fillScreen(ST7735_BLACK);
}
コード例 #13
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testfastlines(uint16_t color1, uint16_t color2) {
    tft.fillScreen(ST7735_BLACK);
    for (int16_t y=0; y < tft.height(); y+=5) {
        tft.drawFastHLine(0, y, tft.width(), color1);
    }
    for (int16_t x=0; x < tft.width(); x+=5) {
        tft.drawFastVLine(x, 0, tft.height(), color2);
    }
}
コード例 #14
0
ファイル: example.cpp プロジェクト: Trekky12/Adafruit_ST7735
void setup() {
    
    Serial.begin(9600);

    tft.initG();
     
    tft.fillScreen(ST7735_BLACK);


}
コード例 #15
0
void displayGrid() {
    tft.fillScreen(0x0000);    // clear the screen with black
    tft.setCursor(0,0);        // set the cursor, indicates where to display
    tft.setTextWrap(false);    // no wrap
   

    tft.print("\n THREES! PUZZLE GAME  \n\n");
    tft.print("      SCORE: ");
    tft.print(score);
    tft.print("\n");


    if (plus) {
        tft.print("            +");
        tft.print(plus);
        tft.print("\n\n");
    }
    else {
        tft.print(" ");
        tft.print("\n\n");
    }

    for(int i=0;i<4;i++) {
        tft.print("  |");

        for(int j=0;j<4;j++) {
            if(grid[i][j]) {
                // use sapce " " to make the interface clear since a number with more digits occupies more space
                if(grid[i][j] < 10) {
                    tft.print(" ");
                    tft.print(grid[i][j]);
                    tft.print(" |");
                }
                else if (grid[i][j] >= 10 && grid[i][j] < 100) {
                    tft.print("");
                    tft.print(grid[i][j]);
                    tft.print(" |");
                }
                else {
                    tft.print("");
                    tft.print(grid[i][j]);
                    tft.print("|");
                }
               
               
            }
            else {
                tft.print(" ");
                tft.print(" ");
                tft.print(" |");
            }
        }
        tft.print("\n\n");
    }
}
コード例 #16
0
ファイル: display.cpp プロジェクト: DD4WH/Teensy-SDR-Rx
void setup_display(void) {
  
  // initialize the LCD display
//  tft.init();
//  tft.initR(INITR_BLACKTAB);   // initialize a S6D02A1S chip, black tab
  tft.setRotation(1);
  tft.fillScreen(BLACK); //BLACK);
  //tft.fillRect(0, pos, 160, 128-pos, BLACK); // erase old string
  tft.setCursor(0, 119);
  tft.setTextColor(WHITE);
  tft.setTextWrap(true);
//  tft.print("DD4WH SDR 5.00");
  
  // Show mid screen tune position
  tft.drawFastVLine(pos_centre_f, 0,pos+1, RED); //WHITE);
 // tft.drawFastHLine(0, pos,79, YELLOW);// WHITE);
  //tft.drawFastHLine(81, pos,79, YELLOW);

// draw S-Meter layout
  tft.drawFastHLine (pos_x_smeter, pos_y_smeter-1, 9*s_w, WHITE);
  tft.drawFastHLine (pos_x_smeter, pos_y_smeter+3, 9*s_w, WHITE);
  tft.fillRect(pos_x_smeter, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+8*s_w, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+2*s_w, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+4*s_w, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+6*s_w, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+7*s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter+3*s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter+5*s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter+s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter+9*s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.drawFastHLine (pos_x_smeter+9*s_w, pos_y_smeter-1, 3*s_w*2+2, GREEN);
  tft.drawFastHLine (pos_x_smeter+9*s_w, pos_y_smeter+3, 3*s_w*2+2, GREEN);
  tft.fillRect(pos_x_smeter+11*s_w, pos_y_smeter-4, 2, 3, GREEN);
  tft.fillRect(pos_x_smeter+13*s_w, pos_y_smeter-4, 2, 3, GREEN);
  tft.fillRect(pos_x_smeter+15*s_w, pos_y_smeter-4, 2, 3, GREEN);
  tft.drawFastVLine (pos_x_smeter-1, pos_y_smeter-1, 5, WHITE); 
  tft.drawFastVLine (pos_x_smeter+15*s_w+2, pos_y_smeter-1, 5, GREEN);

  tft.setCursor(pos_x_smeter - 4, pos_y_smeter - 13);
  tft.setTextColor(WHITE);
  tft.setTextWrap(true);
  tft.print("S 1");
  tft.setCursor(pos_x_smeter + 28, pos_y_smeter - 13);
  tft.print("3");
  tft.setCursor(pos_x_smeter + 48, pos_y_smeter - 13);
  tft.print("5");
  tft.setCursor(pos_x_smeter + 68, pos_y_smeter - 13);
  tft.print("7");
  tft.setCursor(pos_x_smeter + 88, pos_y_smeter - 13);
  tft.print("9");
  tft.setCursor(pos_x_smeter + 120, pos_y_smeter - 13);
  tft.print("+20dB");

} // end void setupdisplay
コード例 #17
0
ファイル: readsd.cpp プロジェクト: adamjford/CMPUT296
void setup(void) {
    Serial.begin(9600);

    // If your TFT's plastic wrap has a Red Tab, use the following:
    tft.initR(INITR_REDTAB);   // initialize a ST7735R chip, red tab
    // If your TFT's plastic wrap has a Green Tab, use the following:
    //tft.initR(INITR_GREENTAB); // initialize a ST7735R chip, green tab

    // how much memory have we got left at this point?
    Serial.print("Avail mem (bytes):");
    Serial.println(AVAIL_MEM);

    Serial.print("Initializing SD card...");
    if (!SD.begin(SD_CS)) {
      Serial.println("failed!");
      return;
    }
    Serial.println("OK!");

    // clear to yellow
    tft.fillScreen(tft.Color565(0xff, 0xff, 0x00));

    lcd_image_draw(&map_image, &tft, 0, 0, 0, 0, 128, 128);

    // how much memory have we got left at this point?
    Serial.print("Avail mem (bytes):");
    Serial.println(AVAIL_MEM);

    // test out reading blocks from the SD card
    if (!card.init(SPI_HALF_SPEED, SD_CS)) {
        Serial.println("Raw SD Initialization has failed");
        while (1) {};  // Just wait, stuff exploded.
        }

    // how much memory have we got left at this point?
    Serial.print("Avail mem (bytes):");
    Serial.println(AVAIL_MEM);
 
    uint32_t block_num = 4000000;
    uint32_t start = millis();
    for (int l=0; l<135; l++) {
        card.readBlock( block_num, (uint8_t *) block_buf);
        // Serial.println(block_buf[1].name);
        }
    uint32_t stop = millis();
    //Serial.println(stop - start);
    
    //dump_block((uint8_t *) block_buf, BLOCK_LEN);
    // Serial.println(block_buf[1].name);

    for(int i = 0; i < 1066; i++) {
      printRest(i);
    }
}
コード例 #18
0
ファイル: client.cpp プロジェクト: elake/assignment3
void initialize_screen() {

    tft.initR(INITR_REDTAB);

    tft.setRotation(0);

    tft.setCursor(0, 0);
    tft.setTextColor(0x0000);
    tft.setTextSize(1);
    tft.fillScreen(BLUE);    
}
コード例 #19
0
ファイル: snake.cpp プロジェクト: Mara2020/Snake
// Printing
// To print snake main display
void snake() {
  // printing to the screen
  tft.fillScreen(BLACK);
  
  tft.fillRoundRect(14,20,100,40,5,CYAN);
  // where the characters will be displayed
  tft.setCursor(20, 30); 
  tft.setTextColor(BLACK);
  tft.setTextSize(3);
  tft.setTextWrap(true);
  tft.print("SNAKE");
}
コード例 #20
0
ファイル: game.cpp プロジェクト: Nessphoro/pong
// initialize round
// place paddles in the middle and initialize ball
void start(Paddle * RedPaddle, Paddle * BluePaddle, Ball * ActiveBall)
{
    tft.fillScreen(BLACK);

    RedPaddle->horzPosition = srcWidth /2 - RedPaddle->size/2;
    BluePaddle->horzPosition = srcWidth /2 - RedPaddle->size/2;

    drawPaddle(RedPaddle);
    drawPaddle(BluePaddle);

    initializeBall(ActiveBall);
}
コード例 #21
0
ファイル: game.cpp プロジェクト: Nessphoro/pong
// shows a countdown on the screen to the start of the game
void countdown()
{
    for(int i=0;i<5;i++)
    {
        tft.fillScreen(BLACK);
        tft.setTextSize(4);
        tft.setCursor(srcWidth/2 - 10, srcHeight/2-10);
        tft.print(5-i);
        delay(1000);
    }
    tft.setTextSize(1);
}
コード例 #22
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void tftPrintTest() {
    tft.setTextWrap(false);
    tft.fillScreen(ST7735_BLACK);
    tft.setCursor(0, 30);
    tft.setTextColor(ST7735_RED);
    tft.setTextSize(1);
    tft.println("Hello World!");
    tft.setTextColor(ST7735_YELLOW);
    tft.setTextSize(2);
    tft.println("Hello World!");
    tft.setTextColor(ST7735_GREEN);
    tft.setTextSize(3);
    tft.println("Hello World!");
    tft.setTextColor(ST7735_BLUE);
    tft.setTextSize(4);
    tft.print(1234.567);
    delay(1500);
    tft.setCursor(0, 0);
    tft.fillScreen(ST7735_BLACK);
    tft.setTextColor(ST7735_WHITE);
    tft.setTextSize(0);
    tft.println("Hello World!");
    tft.setTextSize(1);
    tft.setTextColor(ST7735_GREEN);
    tft.print(p, 6);
    tft.println(" Want pi?");
    tft.println(" ");
    tft.print(8675309, HEX); // print 8,675,309 out in HEX!
    tft.println(" Print HEX!");
    tft.println(" ");
    tft.setTextColor(ST7735_WHITE);
    tft.println("Sketch has been");
    tft.println("running for: ");
    tft.setTextColor(ST7735_MAGENTA);
    tft.print(millis() / 1000);
    tft.setTextColor(ST7735_WHITE);
    tft.print(" seconds.");
}
コード例 #23
0
void setup()  
{
  Serial.begin(9600);

  menuState = TESTKEYPAD_MENU;

  tft.initR(INITR_REDTAB);

  tft.setTextSize(1);
  tft.fillScreen(ST7735_BLACK);
  tft.setCursor(0, 0);
  tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
  sensNum = 0;
}
コード例 #24
0
void displayGameOver() {
    tft.fillScreen(0x0000);    // clear the screen with black
    tft.setCursor(0,0);        // set the cursor, indicates where to display
    tft.setTextWrap(false);    // no wrap
    tft.setTextSize(3);
    tft.print("\n GAME     \n\n");
    tft.print(" OVER\n\n");
    tft.setTextSize(1);
    tft.print("     SCORE: ");
    tft.print(score);
    //~ tft.print("\n TOP 5 OF THE SCORE LIST ");
    // TO_DO: print out the score list, which needs to be saved in SD cardc
   
}
コード例 #25
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testtriangles() {
    tft.fillScreen(ST7735_BLACK);
    int color = 0xF800;
    int t;
    int w = tft.width()/2;
    int x = tft.height()-1;
    int y = 0;
    int z = tft.width();
    for(t = 0 ; t <= 15; t+=1) {
        tft.drawTriangle(w, y, y, x, z, x, color);
        x-=4;
        y+=4;
        z-=4;
        color+=100;
    }
}
コード例 #26
0
void tftPrintTest1() {
  tft.setTextWrap(false);
  tft.fillScreen(ST7735_BLACK);
  tft.setCursor(0, 30);
  tft.setTextColor(ST7735_RED);
  tft.setTextSize(1);
  tft.println("Hello Sming!");
  tft.setTextColor(ST7735_YELLOW);
  tft.setTextSize(2);
  tft.println("Hello Sming!");
  tft.setTextColor(ST7735_GREEN);
  tft.setTextSize(3);
  tft.println("Hello Sming!");
  tft.setTextColor(ST7735_BLUE);
  tft.setTextSize(4);
  tft.print(1234.567);
}
コード例 #27
0
ファイル: assignment2.cpp プロジェクト: adamjford/assignment2
/*
 * Writes out at most 20 restaurants on the screen,
 * starting at the index passed in
 */
void writeOutRestaurants(uint16_t startingIndex, RestDist *distances, uint16_t length) {
  tft.fillScreen(0);
  tft.setCursor(0, 0);
  tft.setTextColor(0xFFFF);
  tft.setTextWrap(false);
  
  for (int i = startingIndex; i < 20 + startingIndex; i++) {
    if(i >= length) {
      break;
    }
    Restaurant r;
    getRestaurant(distances[i].index, &r, &card);
    tft.print(i + 1);
    tft.print(". ");
    tft.print(r.name);
    tft.print("\n");
  }
  tft.print("\n");
}
コード例 #28
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void mediabuttons() {
    // play
    tft.fillScreen(ST7735_BLACK);
    tft.fillRoundRect(25, 10, 78, 60, 8, ST7735_WHITE);
    tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_RED);
    delay(500);
    // pause
    tft.fillRoundRect(25, 90, 78, 60, 8, ST7735_WHITE);
    tft.fillRoundRect(39, 98, 20, 45, 5, ST7735_GREEN);
    tft.fillRoundRect(69, 98, 20, 45, 5, ST7735_GREEN);
    delay(500);
    // play color
    tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_BLUE);
    delay(50);
    // pause color
    tft.fillRoundRect(39, 98, 20, 45, 5, ST7735_RED);
    tft.fillRoundRect(69, 98, 20, 45, 5, ST7735_RED);
    // play color
    tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_GREEN);
}
コード例 #29
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testroundrects() {
    tft.fillScreen(ST7735_BLACK);
    int color = 100;
    int i;
    int t;
    for(t = 0 ; t <= 4; t+=1) {
        int x = 0;
        int y = 0;
        int w = tft.width()-2;
        int h = tft.height()-2;
        for(i = 0 ; i <= 16; i+=1) {
            tft.drawRoundRect(x, y, w, h, 5, color);
            x+=2;
            y+=3;
            w-=4;
            h-=6;
            color+=1100;
        }
        color+=100;
    }
}
コード例 #30
0
void tftPrintTest2() {
  tft.setCursor(0, 0);
  tft.fillScreen(ST7735_BLACK);
  tft.setTextColor(ST7735_WHITE);
  tft.setTextSize(0);
  tft.println("Hello Sming!");
  tft.setTextSize(1);
  tft.setTextColor(ST7735_GREEN);
  tft.print(p, 6);
  tft.println(" Want pi?");
  tft.println(" ");
  tft.print(8675309, HEX); // print 8,675,309 out in HEX!
  tft.println(" Print HEX!");
  tft.println(" ");
  tft.setTextColor(ST7735_WHITE);
  tft.println("Sketch has been");
  tft.println("running for: ");
  tft.setTextColor(ST7735_MAGENTA);
  tft.print(millis() / 1000);
  tft.setTextColor(ST7735_WHITE);
  tft.print(" seconds.");
}