1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Arduino UNOと秋月カラー液晶ST7789V2(SPI)で遊ぶ (「46」よろーを表示)ATM0130B3

Last updated at Posted at 2023-08-02

Arduino UNOと秋月カラー液晶ST7789V3(SPI)で遊ぶ (「46」よろーを表示)ATM0130B3

x Adafruit ST7735 Driver Library for Arduino を インストール
x Adafruit GFX Library を インストール

目的
カラー液晶のテスト

o_cop635.jpg

o_cop636.jpg

プログラム




//spi_st7789_NUM_TEST1_uno_1


//ヘッダーファイル
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>


//定義
#define TFT_CS        10
#define TFT_RST        9 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC         8
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);


//初期化
void setup() {

  //240x240の液晶を使用する。
  tft.init(240, 240);           // Init ST7789 240x240

}//setup


//メインループ
void loop() {

  // 画面表示をクリア
  tft.fillScreen(ST77XX_BLACK);

  // テキストサイズを設定
  tft.setTextSize(5);
  // テキスト色を設定
  tft.setTextColor(ST77XX_WHITE);
  // テキストの開始位置を設定
  tft.setCursor(0, 10);


  //46を設定
  int tempval = 46;

  //表示変換する
  char str1[3];
  str1[0] = '0' + (tempval/10);
  str1[1] = '0' + (tempval%10);
  str1[2] = 0;


  // 1行目に数字を表示
  tft.println(str1);


  delay(1000); //1秒待つ

}//loop



1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?