Img2Code を使って Arduino ESP32 で ILI9341 液晶にビットマップを表示する


![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/139524/c0677bca-01ff-e62f-3f62-74683cb8c092.png)

Arduino系でビットマップを表示させるには、SDカードなどに画像を入れて表示させるのが一般的です。しかしながら簡単な画像であればコード中に画像を埋め込む方法もできます。今回は Img2Codeというツールを使って画像を埋め込み、表示してみます。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/139524/58dbf549-7452-f744-9aae-17df87ed506c.png)

# 環境

- Ubuntu Linux 20.04
- Arduino ESP32
- ILI9341 LCD
https://qiita.com/nanbuwks/items/72503cf93c5f2ed0deeb


- openjdk-11 

( 「Ubuntu 20.04 で Java をインストール」
https://qiita.com/nanbuwks/items/e0b620e30b76d5d181dc
でインストールした Java )

# Img2Code とは

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/139524/91dfec6c-6786-654a-498c-1329451c46fd.png)

Javaプログラム。

https://github.com/ehubin/Adafruit-GFX-Library/tree/master/Img2Code

ファイルを読み込んでデータ文字にするらしい。

# 実行

README の通り gradle を使ってビルドしようとしたがダメだった。

```

$ ./gradlew

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
```

となりました。
stacktrace を見ると

```

$ ./gradlew --stacktrace


FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.internal.service.ServiceCreationException: Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:816)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:767)
        at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.getInstance(DefaultServiceRegistry.java:571)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:628)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.assembleParameters(DefaultServiceRegistry.java:780)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:766)
        at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.getInstance(DefaultServiceRegistry.java:571)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:628)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.assembleParameters(DefaultServiceRegistry.java:780)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:766)
        at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.getInstance(DefaultServiceRegistry.java:571)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:628)
        at org.gradle.internal.service.DefaultServiceRegistry.find(DefaultServiceRegistry.java:295)
        at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:284)
        at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:279)
        at org.gradle.initialization.DefaultGradleLauncherFactory.doNewInstance(DefaultGradleLauncherFactory.java:179)
        at org.gradle.initialization.DefaultGradleLauncherFactory.newInstance(DefaultGradleLauncherFactory.java:108)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:40)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:61)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:34)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:46)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.service.ServiceCreationException: Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:816)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:767)
        at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.getInstance(DefaultServiceRegistry.java:571)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:628)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.assembleParameters(DefaultServiceRegistry.java:780)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:766)
        at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.getInstance(DefaultServiceRegistry.java:571)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:628)
        at org.gradle.internal.service.DefaultServiceRegistry.find(DefaultServiceRegistry.java:295)
        at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:284)
        at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:279)
        at org.gradle.internal.service.scopes.BuildScopeServices.defaultScriptPluginFactory(BuildScopeServices.java:301)
        at org.gradle.internal.service.scopes.BuildScopeServices.createScriptPluginFactory(BuildScopeServices.java:293)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.internal.service.ReflectionBasedServiceMethod.invoke(ReflectionBasedServiceMethod.java:35)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:814)
        ... 61 more
Caused by: org.gradle.api.GradleException: Could not generate a proxy class for class org.gradle.plugin.management.internal.DefaultPluginResolutionStrategy.
        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:228)
        at org.gradle.api.internal.AbstractClassGenerator.generate(AbstractClassGenerator.java:80)
        at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
        at org.gradle.plugin.internal.PluginUsePluginServiceRegistry$BuildScopeServices.createPluginResolutionStrategy(PluginUsePluginServiceRegistry.java:106)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.internal.service.ReflectionBasedServiceMethod.invoke(ReflectionBasedServiceMethod.java:35)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:814)
        ... 79 more
Caused by: java.lang.NoSuchMethodError: 'java.lang.Class sun.misc.Unsafe.defineClass(java.lang.String, byte[], int, int, java.lang.ClassLoader, java.security.ProtectionDomain)'
        at org.gradle.internal.classloader.ClassLoaderUtils.define(ClassLoaderUtils.java:104)
        at org.gradle.model.internal.asm.AsmClassGenerator.define(AsmClassGenerator.java:58)
        at org.gradle.model.internal.asm.AsmClassGenerator.define(AsmClassGenerator.java:54)
        at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.generate(AsmBackedClassGenerator.java:967)
        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:226)
        ... 88 more


* Get more help at https://help.gradle.org

BUILD FAILED in 1s
```

うーん、gradle 嫌い。

gradle を動かしたいのではなくて Adafruit-GFX-Library-master/Img2Code/src/main/java/Image2Code.java を動かしたいので
Adafruit-GFX-Library-master/Img2Code/src/main/java/ に移って以下のようにしました。

```

$ java Image2Code.java

```
エラー

```

Gtk-Message: 22:44:04.263: Failed to load module "canberra-gtk-module"
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null!
	at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1400)
	at Image2Code$ThePanel.loadURL(Image2Code.java:129)
	at Image2Code$ThePanel.<init>(Image2Code.java:199)
	at Image2Code$1.run(Image2Code.java:56)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
```

```

$ sudo apt install libcanberra-gtk-module
```

としましたが、次は

```

$ java Image2Code.java
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null!
	at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1400)
	at Image2Code$ThePanel.loadURL(Image2Code.java:129)
	at Image2Code$ThePanel.<init>(Image2Code.java:199)
	at Image2Code$1.run(Image2Code.java:56)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
```

Image2Code.java の129行目

```

                                master = ImageIO.read(in);
```

でエラーなのですが、in は デフォルトで Adafruit.png という文字になっていたので Adafruit-GFX-Library-master/Img2Code/src/main/resources にあった Adafruit.png をカレントディレクトリに持ってきて

```

$ java Img2Code.java

```

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/139524/91dfec6c-6786-654a-498c-1329451c46fd.png)
動きました。

# 変換動作

試しところ、 jpg/gif/bmp/png が読めました。

非圧縮の二値データになるっぽい。

使い方は
「Arduino TFT LCD GUI &#8211; Load Bitmap Image - Emacs, Arduino, Raspberry Pi, Linux and Programming etc」
http://tech.memoryimprintstudio.com/arduino-tft-lcd-gui-load-bitmap-image/
によると、

出てきたものをコピペして

```

static const uint8_t  PROGMEM myBitmap[] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,
```

描画は以下

```

    tft.drawBitmap(160, 120, myBitmap, 82, 77,65535);
```

のようにすれば良いそうです。最後の 65535 は16bit 5-6-5 の 色コードで、白にしてみました。


上記を含み、作成したスケッチがこれ。


```

#include "SPI.h"
#include <Adafruit_ILI9341.h>

#define TFT_RST 16
#define TFT_DC 17
#define TFT_CS 5
#define TFT_BACKLIGHT_PIN 4


static const uint8_t  PROGMEM myBitmap[] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xe1,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xe0,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xc0,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0x80,0x7f,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0x0,0x7f,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0x0,0x7f,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xfe,0x0,0x3f,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xfc,0x0,0x3f,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xfc,0x0,0x3f,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xf8,0x0,0x1f,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xf0,0x0,0x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0,0x3f,0xff,0xff,0xc0,
0xff,0xfe,0x0,0x0,0xc,0x0,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xfe,0x0,0x0,0x1e,0x0,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xfc,0x0,0x0,0x3e,0x0,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xfc,0x0,0x0,0x7f,0x0,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xfc,0x0,0x1,0xff,0x0,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xf8,0x0,0xf,0xff,0x80,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xf8,0x0,0x7f,0xff,0xc0,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xf8,0x3,0xff,0xff,0xe0,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xfc,0x1f,0xff,0xff,0xf8,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xfc,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xfe,0x0,0x3f,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x3f,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x3f,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x3f,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x3f,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x7f,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};



Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC,TFT_RST);


void setup() {
  tft.begin();
  pinMode(TFT_BACKLIGHT_PIN,OUTPUT);
  digitalWrite(TFT_BACKLIGHT_PIN,HIGH);
}

void loop(void) {
  for(uint8_t r=0; r<4; r++) {
    tft.setRotation(r);
    tft.fillScreen(ILI9341_BLACK);
    tft.drawBitmap(160, 120, myBitmap, 82, 77,65535);
    delay(3000);
  }
}
```

実行すると画面に表示されました。




![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/139524/f7ca30ac-d58b-50b5-0522-b065d67ee36b.png)