Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "SPI.h"
- #include "Adafruit_GFX.h"
- #include "Adafruit_ILI9341.h"
- const int TFT_CS = 10;
- const int TFT_DC = 9;
- Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
- const int TILE_W = 15;
- const int BOARD_W = 10 * TILE_W, BOARD_H = 20 * TILE_W;
- bool board[10][20];
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- tft.begin();
- for (int i = 0; i < 8; i++) {
- pinMode(i, INPUT_PULLUP);
- }
- tft.fillScreen(ILI9341_BLACK);
- tft.drawRect(5, 5, BOARD_W + 2, BOARD_H + 2, ILI9341_WHITE);
- board[2][5] = 1;
- }
- void loop() {
- // put your main code here, to run repeatedly:
- tft.setTextColor(ILI9341_WHITE);
- tft.setCursor(0, 0);
- // Serial.println(digitalRead(5));
- delay(100);
- for (int i = 0; i < 10; i++) {
- for (int j = 0; j < 20; j++) {
- if (board[i][j]) {
- tft.fillRect(6 + i * TILE_W, 6 + j * TILE_W, TILE_W, TILE_W, ILI9341_BLUE);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement