Jenna Zhu
Published

Wio Terminal - Pokemon Game !

This guide covers how to use the Wio Terminal to build a small Pokemon Game.

BeginnerWork in progress2 hours387
Wio Terminal - Pokemon Game !

Things used in this project

Hardware components

Wio Terminal
Seeed Studio Wio Terminal
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Code

C/C++
#include"TFT_eSPI.h"
#include "Seeed_FS.h" //Including SD card library
#include"RawImage.h"  //Including image processing library
TFT_eSPI tft;
 
void setup() {
    //Initialise SD card
    if (!SD.begin(SDCARD_SS_PIN, SDCARD_SPI)) {
        while (1);
    }
    tft.begin();

    /*初始化按键*/
    pinMode(WIO_KEY_A, INPUT_PULLUP);
    pinMode(WIO_KEY_B, INPUT_PULLUP);
    pinMode(WIO_KEY_C, INPUT_PULLUP);

    /*开场画面*/
    tft.setRotation(3);
    drawImage<uint8_t>("1.bmp", 0, 0); //Display this 8-bit image in sd card from (0, 0)
    /*tft.fillScreen(0xFFFF);*/
    tft.setTextSize(2);
    tft.drawString((String)"Welcome to Pokemon", 50, 100);
}

void Status(){
  drawImage<uint8_t>("pikaquangery.bmp", 0, 0);
  tft.setTextSize(1);
  tft.drawString((String)"Press C to Back", 10, 220);
}

void Eat(){
  drawImage<uint8_t>("pikaqueat.bmp", 0, 0);
  tft.setTextSize(1);
  tft.drawString((String)"Press C to Back", 10, 220);
}

void loop() {

      /*主菜单*/
    if (digitalRead(WIO_KEY_C) == LOW) {
      tft.fillScreen(0x0);
      tft.setTextSize(2);
      tft.drawString((String)"Please choose.", 10, 10);
      tft.drawString((String)"A. Status", 10, 50);
      tft.drawString((String)"B. Eat", 10, 70);
      while (digitalRead(WIO_KEY_C) == LOW == false) {
        if (digitalRead(WIO_KEY_A) == LOW) {
          Status();
        }
        if (digitalRead(WIO_KEY_B) == LOW) {
          Eat();
        }
      }
    }
}

Credits

Jenna Zhu
2 projects • 4 followers
Contact
Thanks to Seeed.

Comments

Please log in or sign up to comment.