10
13

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 5 years have passed since last update.

ESP32でテトリスを作ってみた

Last updated at Posted at 2017-04-09

0b7a4f85-3aa7-7ef4-1444-3140b4769880.jpg
表示はAitendoの液晶モジュール(950円)を使用しました。操作はAndroidケータイからWiFiを通じて無線で行う、またはUSBからSerial Portを通じて行います。esp32については自分の動画 【ゆっくり解説】 WiFiの使い方2 【電子工作】で紹介しています。
#準備
以下のものを用意します。

#配線
ESP32と液晶を以下のように配線します。
キャプチャ.PNG
DSC_0007.JPG

プログラム

開発環境はArduino-esp32を使います。
プログラムはesp32_ST7735_Tetrisになります。自分の動画【ゆっくり解説】 テトリスの作り方 【ゲームプログラミング】を参考にしました。

コントローラの設定

Serial Portを使うときはテンキーの8(↑ボタン), 6(→ボタン), 2(↓ボタン), 4(←ボタン) と zキー(Aボタン), xキー(Bボタン)を使います。

AndroidケータイではWiFi TCP/UDP ControllerでボタンにSerial Portのときと同じASCIIコードを充てます。TCP/UDPはUDP、IPは192.168.4.1、Portは10000に設定します。これらの設定は手動でも行えますが、プログラムのフォルダにあるWiFi_UDP_Controller_config.txtをAndroidのフォルダマネジャーでホームフォルダ/Controller Backup に置き、WiFi TCP/UDP Controllerでロードすることでも行えます。
C83Ln76U0AAS8wr.jpg

ゲーム開始

esp32に電源を入れるとテトリスの画面が現れます。AndroidケータイでWiFiをESP32につなげてWiFi TCP/UDP Controllerを立ち上げ、Aボタンを押すと開始します。

10
13
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
10
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?