WiFiBoy32
Post date: 2018/08/11 1:50:26
WiFiBoy32を Makere Faire Tokyo 2018 で購入.結構楽しい.
- Setup (Windows10)
- Arduino
- git (bash)
- arduino-esp32 for windows
- Git GUI : Clone Existing Repository
- target : https://github.com/espressif/arduino-esp32.git
- source : C:/Users/_USERNAME_/Documents/Arduino/hardware/espressif/esp32
- Git Bash
- $ cd Documents/Arduino/hardware/espressif/esp32
- $ git submodule update --init --recursive
- Explorer から tools/get.exe を実行
- Git GUI : Clone Existing Repository
- CP210x USB to UART Bridge VCP Drivers(入っていた)
- Arduino
- ツール>ボード : ESP32 Dev Module
- ツール>COM : COMXX
- WiFiBoy32Lib.zip をインストール
- Samples
- BLINK : setup() の前に一行追加
- int LED_BUILTIN=16; // WiFiBoy32
- WiFiBoy32 Tutorials : tetris, brick, garaxian, L-game, tello controller, etc.
- BLINK : setup() の前に一行追加
ref:
- Arduino/libraries/wifiboy32/wfiboy32.h : wb32lcd 描画関数(wb32)XXX()), 色指定(wbWHITEなど)
- WiFiBoy32 Tutorials
- WiFiBoy.Club
Sample: HellowWorldPush
/*
* Hello World for WiFiBoy32
*/
#include <wifiboy32.h>
#define PIN_L 17 // Button L (Green)
#define PIN_R 32 // Button R (Red)
#define PIN_U 33 // Button U (Blue)
#define PIN_D 27 // Button D (Yellow)
#define BUTTON_ON 0
void setup() {
Serial.begin(115200);
wb32_init();
wb32_setTextColor(wbGREEN, wbGREEN);
pinMode(PIN_L,INPUT);
pinMode(PIN_R,INPUT);
pinMode(PIN_U,INPUT);
pinMode(PIN_D,INPUT);
}
int last_key=0;
int str_x=0, str_y=0;
void loop() {
if (digitalRead(PIN_L)==BUTTON_ON && last_key!=PIN_L){
clear_display();
wb32_setTextColor(wbGREEN, wbGREEN);
str_x=20; str_y=150;
wb32_drawString("Push L", 5, 23, 2, 2);
last_key=PIN_L;
}
if (digitalRead(PIN_R)==BUTTON_ON && last_key!=PIN_R){
clear_display();
wb32_setTextColor(wbRED, wbRED);
str_x=140; str_y=150;
wb32_drawString("Push R", 5, 23, 2, 2);
last_key=PIN_R;
}
if (digitalRead(PIN_U)==BUTTON_ON && last_key!=PIN_U){
clear_display();
wb32_setTextColor(wbBLUE, wbBLUE);
str_x=80; str_y=20;
wb32_drawString("Push U", 5, 23, 2, 2);
last_key=PIN_U;
}
if (digitalRead(PIN_D)==BUTTON_ON && last_key!=PIN_D){
clear_display();
wb32_setTextColor(wbYELLOW, wbYELLOW);
str_x=80; str_y=290;
wb32_drawString("Push D", 5, 23, 2, 2);
last_key=PIN_D;
}
wb32_drawString("Hello World", str_x, str_y, 1, 2);
}
void clear_display(){
wb32_fillRect(0,0,240,320,0);
}/*
* Hello World for WiFiBoy32
*/
#include <wifiboy32.h>
#define PIN_L 17 // Button L (Green)
#define PIN_R 32 // Button R (Red)
#define PIN_U 33 // Button U (Blue)
#define PIN_D 27 // Button D (Yellow)
#define BUTTON_ON 0
void setup() {
Serial.begin(115200);
wb32_init();
wb32_setTextColor(wbGREEN, wbGREEN);
pinMode(PIN_L,INPUT);
pinMode(PIN_R,INPUT);
pinMode(PIN_U,INPUT);
pinMode(PIN_D,INPUT);
}
int last_key=0;
int str_x=0, str_y=0;
void loop() {
if (digitalRead(PIN_L)==BUTTON_ON && last_key!=PIN_L){
clear_display();
wb32_setTextColor(wbGREEN, wbGREEN);
str_x=20; str_y=150;
wb32_drawString("Push L", 5, 23, 2, 2);
last_key=PIN_L;
}
if (digitalRead(PIN_R)==BUTTON_ON && last_key!=PIN_R){
clear_display();
wb32_setTextColor(wbRED, wbRED);
str_x=140; str_y=150;
wb32_drawString("Push R", 5, 23, 2, 2);
last_key=PIN_R;
}
if (digitalRead(PIN_U)==BUTTON_ON && last_key!=PIN_U){
clear_display();
wb32_setTextColor(wbBLUE, wbBLUE);
str_x=80; str_y=20;
wb32_drawString("Push U", 5, 23, 2, 2);
last_key=PIN_U;
}
if (digitalRead(PIN_D)==BUTTON_ON && last_key!=PIN_D){
clear_display();
wb32_setTextColor(wbYELLOW, wbYELLOW);
str_x=80; str_y=290;
wb32_drawString("Push D", 5, 23, 2, 2);
last_key=PIN_D;
}
wb32_drawString("Hello World", str_x, str_y, 1, 2);
}
void clear_display(){
wb32_fillRect(0,0,240,320,0);
}