ESP-WROOM-02開発ボードをセットアップする!

はじめに、ESP-WROOM-02開発ボードをまずはセットアップする。(arduino unoも合わせてする予定だったが、部屋に忘れた)
先人の知恵、と言うわけでCheck! ESP-WROOM-02 開発ボードの始め方 – Qiitaを参考にセットアップ

(ESP-WROOM-02開発ボード 製品情報)

はじめに、マイコンボードを登録します。

Installing with Boards Manager
Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).
1.Install Arduino 1.6.8 from the Arduino website.
2.Start Arduino and open Preferences window.
3.Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
4.Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
5.The best place to ask questions related to this core is ESP8266 community forum: http://www.esp8266.com/arduino. If you find this forum or the ESP8266 Boards Manager package useful, please consider supporting it with a donation.

esp8266/Arduino: ESP8266 core for Arduino

1.arduino IDEインストールします。

2.arduino IDE起動してPrefrences(環境設定)を表示させます。

3.Additional Board Managerに http://arduino.esp8266.com/stable/package_esp8266com_index.json を入力します

4.Tools > Board を表示させて、sp8266 platform をインストールさせます。


ま、そんな感じですねw

シリアル接続で動作確認

シリアルモニタを表示する

画面にいろいろありますが、右上の虫眼鏡をクリックします。

シリアルモニタを設定する

初期状態ではATコマンドが利用可能です。

改行 CRおよびLF
転送速度 115200bps

この設定で通信可能です。(arduinoを書き込むと応答されません)

ちなみに、74880bpsにして、リセットボタンを押すとこんなのが出ます…
出るだけですがw

さて、使うぞ!

適当にスケッチ例から選んで書き込む

はい、書き込みます。

windowsなら普通に通るらしいですが、macOSの場合以下のエラーが発生します。

Arduino:1.8.1 (Mac OS X), ボード:"Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 9600, 512K (64K SPIFFS), nodemcu, Disabled, None"

最大434160バイトのフラッシュメモリのうち、スケッチが222145バイト(51%)を使っています。
最大81920バイトのRAMのうち、グローバル変数が31512バイト(38%)を使っていて、ローカル変数で50408バイト使うことができます。
Uploading 226288 bytes from /var/folders/g1/5ksqzh0n1hj459p88v1vhh740000gn/T/arduino_build_530916/Blink.ino.bin to flash at 0x00000000
warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
warning: espcomm_send_command: didn't receive command response
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

「ファイル」メニューの「環境設定」から
「より詳細な情報を表示する:コンパイル」を有効にすると
より詳しい情報が表示されます。

はい、書き込みにエラーです;;
ちょっぴり調べると:warning: espcomm_sync failed error: espcomm_open failed // ESP-01 // Wiring up the right way shuts my ESP off · Issue #770 · esp8266/Arduino
はい、的確な答えはありませんねw

しかしヒントはありました、9600?さっそく、115200bpsとしました。(ATコマンドの設定から)

再度実行すると…

ビルドオプションが変更されました。全体をリビルドしています。
最大434160バイトのフラッシュメモリのうち、スケッチが221939バイト(51%)を使っています。
最大81920バイトのRAMのうち、グローバル変数が31504バイト(38%)を使っていて、ローカル変数で50416バイト使うことができます。
Uploading 226080 bytes from /var/folders/g1/5ksqzh0n1hj459p88v1vhh740000gn/T/arduino_build_721046/sketch_feb14a.ino.bin to flash at 0x00000000
................................................................................ [ 36% ]
................................................................................ [ 72% ]
.............................................................                    [ 100% ]

きゃっほぉー!

出来ました。
これで開発が開発できます。

今日はこれで終わりです。
次回はLチカ出来るかな… LED買ってこなきゃw