文章目录
- 1 前言
- 2 msa300数据分析
- 3 代码逻辑
-
- 3.1 实现转动切换显示
- 3.2 增加水平判断
- 3.3 补充
- 4 代码实现——v1_基础功能
- 5 代码实现——v2_增加水平判断
- 6 结果
1 前言
在显示的示例中,可以看到两个时钟显示画面(表盘和数字),但是他们的切换是定时的,打算利用三轴加速器获取偏移数据实现显示图片的切换。
设计分三步
1 显示图片
2 获取偏移数据
3 判断是否需要切换图片
第三步比较关键,前两步可以参考我另外两章介绍。
2 msa300数据分析
首先我们需要知道自己板子不同角度对应的数值,以掌控板2.0为例。
将屏幕朝上,水平放置时,初始状态y应为0,但考虑到误差,y轴数值允许在-100~100之间。
水平时,我们将屏幕向左侧转动,角度大概为45°时,y值约为1200
水平时,我们将屏幕向右侧转动,角度大概为45°时,y值约为-1200
水平时,我们将屏幕向左侧转动,角度大概为90°时,y值约为2000
水平时,我们将屏幕向右侧转动,角度大概为90°时,y值约为-2000
至此我们知道了偏移数据的范围,后续就需要获取y值并作出判断。
3 代码逻辑
3.1 实现转动切换显示
这一点比较简单,我们设定两个y值,分别为y_old,y_new,当temp=y_new-y_old,大于0表示向左转,小于0表示向右转。
然后设定一个偏移范围,当temp大于1200时,则触发左转动作(即切换上一张图片),当temp小于-1200时,则触发右转动作(即切换下一张图片)。
这个代码参见v1_基础功能。
3.2 增加水平判断
v1版本测试会发现,水平时迅速向左侧转动,然后回正,则图片先切到上一张,然后又切回来了。
这是因为迅速回正的时候也会触发右转事件,这就需要修改下触发条件。
我列了三个方法
a. 触发转动后等待两秒
b. 提高转动阈值,无效
c. 判断当前y值(y_new)是否在水平范围内(-500~500)
第三种方法较可行。
3.3 补充
图片显示有5张,我设定了左转最终只能切换到第一张,右转最终切换到最后一张,如果需要循环显示,可以修改显示判断demoMode。
4 代码实现——v1_基础功能
主体代码
//file main.ino
// Include the correct display library
// For a connection via I2C using the Arduino Wire include:
#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
#include "SH1106Wire.h" // legacy: #include "SSD1306.h"// Optionally include custom images
#include "images_bmp.h"// Initialize the OLED display using Arduino Wire:
SH1106Wire display(0x3c, 23, 22); // ADDRESS, SDA, SCL - SDA and SCL usually populate automatically based on your board's pins_arduino.h e.g. https://github.com/esp8266/Arduino/blob/master/variants/nodemcu/pins_arduino.h// Include the correct msa300 library
#include <Adafruit_MSA301.h>Adafruit_MSA301 msa;#include "math.h"void msa300_init() {
Serial.println("Adafruit MSA301 test!");// Try to initialize!//38,msa301_wireif (! msa.begin()) {
Serial.println("Failed to find MSA301 chip");while (1) {
delay(10); }}Serial.println("MSA301 Found!");}#define MSA_Y_CHANGE_RANGE_MAX 1500
#define MSA_Y_CHANGE_RANGE_MIN -1500
#define DEMO_DURATION 3000
typedef void (*Demo)(void);int demoMode = 0;
int counter = 1;void setup() {
Serial.begin(115200);Serial.println();Serial.println();// Initialising the UI will init the display too.display.init();display.flipScreenVertically();display.setFont(ArialMT_Plain_10);msa300_init();
}void drawFontFaceDemo() {
// Font Demo1// create more fonts at http://oleddisplay.squix.ch/display.setTextAlignment(TEXT_ALIGN_LEFT);display.setFont(ArialMT_Plain_10);display.drawString(0, 0, "Hello world");display.setFont(ArialMT_Plain_16);display.drawString(0, 10, "Hello world");display.setFont(ArialMT_Plain_24);display.drawString(0, 26, "Hello world");
}void drawTextFlowDemo() {
display.setFont(ArialMT_Plain_10);display.setTextAlignment(TEXT_ALIGN_LEFT);display.drawStringMaxWidth(0, 0, 128,"Lorem ipsum\n dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore." );
}void drawTextAlignmentDemo() {
// Text alignment demodisplay.setFont(ArialMT_Plain_10);// The coordinates define the left starting point of the textdisplay.setTextAlignment(TEXT_ALIGN_LEFT);display.drawString(0, 10, "Left aligned (0,10)");// The coordinates define the center of the textdisplay.setTextAlignment(TEXT_ALIGN_CENTER);display.drawString(64, 22, "Center aligned (64,22)");// The coordinates define the right end of the textdisplay.setTextAlignment(TEXT_ALIGN_RIGHT);display.drawString(128, 33, "Right aligned (128,33)");
}void drawRectDemo() {
// Draw a pixel at given positionfor (int i = 0; i < 10; i++) {
display.setPixel(i, i);display.setPixel(10 - i, i);}display.drawRect(12, 12, 20, 20);// Fill the rectangledisplay.fillRect(14, 14, 17, 17);// Draw a line horizontallydisplay.drawHorizontalLine(0, 40, 20);// Draw a line horizontallydisplay.drawVerticalLine(40, 0, 20);
}void drawCircleDemo() {
for (int i = 1; i < 8; i++) {
display.setColor(WHITE);display.drawCircle(32, 32, i * 3);if (i % 2 == 0) {
display.setColor(BLACK);}display.fillCircle(96, 32, 32 - i * 3);}
}void drawProgressBarDemo() {
int progress = (counter / 5) % 100;// draw the progress bardisplay.drawProgressBar(0, 32, 120, 10, progress);// draw the percentage as Stringdisplay.setTextAlignment(TEXT_ALIGN_CENTER);display.drawString(64, 15, String(progress) + "%");
}void drawImageDemo() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits);
}void drawImageDemo_lang() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits_lang);
}//WiFi_Logo_bits_1,WiFi_Logo_bits_2,WiFi_Logo_bits_3
void drawImageDemo_1() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits_1);
}void drawImageDemo_2() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits_2);
}void drawImageDemo_3() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits_3);
}// Demo demos[] = {drawFontFaceDemo, drawTextFlowDemo, drawTextAlignmentDemo, drawRectDemo, drawCircleDemo, drawProgressBarDemo, drawImageDemo};
Demo demos[] = {
drawImageDemo, drawImageDemo_lang, drawImageDemo_1, drawImageDemo_2, drawImageDemo_3};
int demoLength = (sizeof(demos) / sizeof(Demo));
long timeSinceLastModeSwitch = 0;void change_display_bmp(){
demoMode = (demoMode + 1) % demoLength;
// delay(2000);
}//int16_t x_old,x_new,y_old,y_new,z_old,z_new;
int16_t x_old = 0;
int16_t x_new = 0;
int16_t y_old = 0;
int16_t y_new = 0;
int16_t z_old = 0;
int16_t z_new = 0;//int16_t x_old,x_new,y_old,y_new,z_old,z_new;
//x_old = 0;
//x_new = 0;
//y_old = 0;
//y_new = 0;
//z_old = 0;
//z_new = 0;void get_msa300(){
//get msa xyz valuemsa.read(); // get X Y and Z data at once// Then print out the raw dataSerial.print("X: "); Serial.print(msa.x); Serial.print(" \tY: "); Serial.print(msa.y); Serial.print(" \tZ: "); Serial.print(msa.z); Serial.println();x_old = x_new;y_old = y_new;z_old = z_new;x_new = msa.x;y_new = msa.y;z_new = msa.z;Serial.print(x_old);Serial.print(" \t");Serial.print(x_new);Serial.print("; \t");Serial.print(y_old);Serial.print(" \t");Serial.print(y_new);Serial.print("; \t");Serial.print(z_old);Serial.print(" \t");Serial.print(z_new);Serial.print("; \t");Serial.println();
}void reset_old_value(){
msa.read();Serial.print("\nreset old value start\n");Serial.print("print y_old&y_new \t");Serial.print(y_old);Serial.print(" \t");Serial.print(y_new);Serial.print("; \t");x_old = msa.x;y_old = msa.y;z_old = msa.z;Serial.print("\nreset old value end\n");Serial.print("print y_old&y_new \t");Serial.print(y_old);Serial.print(" \t");Serial.print(y_new);Serial.print("; \t");
}void display_bmp(){
// 1. display// clear the displaydisplay.clear();// draw the current demo methoddemos[demoMode]();display.setFont(ArialMT_Plain_10);display.setTextAlignment(TEXT_ALIGN_RIGHT);//display.drawString(128, 54, String(millis()));// write the buffer to the displaydisplay.display();
}void loop() {
// get msa300 value get_msa300();Serial.print("print y_old&y_new \t");Serial.print(y_old);Serial.print(" \t");Serial.print(y_new);Serial.print("; \t");Serial.println();int16_t temp = y_new - y_old;Serial.print("temp");Serial.print(temp);Serial.println();//3. judge if change pictureif (temp > MSA_Y_CHANGE_RANGE_MAX){
Serial.print("change_display_bmp left\n");if (demoMode == 0){
Serial.print("left end\n");}else{
demoMode = (demoMode - 1) % demoLength;}display_bmp();//delay(2000);//wait_device_stablereset_old_value();temp=0;}else if (temp < MSA_Y_CHANGE_RANGE_MIN){
//(abs(y_new) < 500)Serial.print("change_display_bmp right\n");if (demoMode == demoLength-1){
Serial.print("right end\n");}else{
demoMode = (demoMode + 1) % demoLength;}display_bmp();//delay(2000);//wait_device_stablereset_old_value();temp=0;}//wait device change picture until status is balancedelay(500);
// change_display_bmp();}
显示图像数据,根据字模软件生成
//file display date
#define WiFi_Logo_width 128
#define WiFi_Logo_height 64
const uint8_t WiFi_Logo_bits[] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDF,0xF6,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB8,0xB6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x7F,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x00,0x80,0x01,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x80,0x00,0x00,0x80,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x01,0x00,0x80,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x03,0x00,0x80,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x80,0x01,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x04,0x00,0x00,0x01,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x08,0x00,0x00,0x01,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x10,0x00,0x00,0x03,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x30,0x00,0x00,0x03,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0xC0,0x00,0x00,0x07,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xBC,0x01,0x00,0x80,0x01,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB4,0x06,0xFC,0x01,0x00,0x0C,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x03,0x00,0x00,0x38,0x60,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x0B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xBE,0x01,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0xFD,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};const uint8_t WiFi_Logo_bits_lang[] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x80,0x23,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0xE0,0x21,0x3E,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x10,0x12,0x02,0x00,0x00,0x00,0x00,0x00,0x80,0xF4,0x07,0x00,0x00,0x00,0x00,0xC0,0x11,0x32,0x02,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x04,0x00,0x00,0x00,0x00,0x40,0x11,0x32,0x02,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x04,0x00,0x00,0x00,0x00,0x20,0x19,0x22,0x02,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x0B,0x42,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x02,0x7E,0x00,0x00,0x00,0x20,0x0E,0xE2,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x82,0xC1,0x00,0x00,0x00,0x00,0x00,0x81,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x82,0x80,0x01,0x00,0x00,0x00,0x20,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1A,0x81,0x07,0x01,0x00,0x00,0x20,0x30,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x01,0x0B,0x01,0x00,0x00,0x00,0xD0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x01,0x13,0x01,0x00,0x00,0x10,0xC8,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE1,0x80,0x22,0x02,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x42,0x02,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x80,0x03,0x00,0x00,0x10,0x03,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x42,0x02,0x05,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x02,0x06,0x00,0x00,0x90,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x25,0x04,0x00,0x00,0x00,0x48,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x25,0x04,0x00,0x00,0x00,0x28,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC1,0x38,0x00,0x00,0x00,0x00,0x28,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x18,0x04,0x00,0x00,0x00,0x18,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x0F,0x80,0x3F,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x34,0x04,0xF0,0xC0,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x01,0x04,0x08,0x80,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5A,0x00,0x04,0x04,0xC0,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x02,0x00,0x02,0x04,0x60,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x81,0x03,0x02,0x07,0x20,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x80,0x3C,0x01,0x05,0x20,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x80,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x30,0x81,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x98,0x41,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x88,0x40,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x20,0x88,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x70,0x20,0x10,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x2C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x10,0x10,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x0C,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x07,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x10,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0C,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};const uint8_t WiFi_Logo_bits_1[] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};const uint8_t WiFi_Logo_bits_2[] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xAD,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};const uint8_t WiFi_Logo_bits_3[] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x28,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xBC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
5 代码实现——v2_增加水平判断
主体代码
//file main.ino
// Include the correct display library
// For a connection via I2C using the Arduino Wire include:
#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
#include "SH1106Wire.h" // legacy: #include "SSD1306.h"// Optionally include custom images
#include "images_bmp.h"// Initialize the OLED display using Arduino Wire:
SH1106Wire display(0x3c, 23, 22); // ADDRESS, SDA, SCL - SDA and SCL usually populate automatically based on your board's pins_arduino.h e.g. https://github.com/esp8266/Arduino/blob/master/variants/nodemcu/pins_arduino.h// Include the correct msa300 library
#include <Adafruit_MSA301.h>Adafruit_MSA301 msa;#include "math.h"void msa300_init() {
Serial.println("Adafruit MSA301 test!");// Try to initialize!//38,msa301_wireif (! msa.begin()) {
Serial.println("Failed to find MSA301 chip");while (1) {
delay(10); }}Serial.println("MSA301 Found!");}#define MSA_Y_CHANGE_RANGE_MAX 1500
#define MSA_Y_CHANGE_RANGE_MIN -1500
#define DEMO_DURATION 3000
typedef void (*Demo)(void);int demoMode = 0;
int counter = 1;void setup() {
Serial.begin(115200);Serial.println();Serial.println();// Initialising the UI will init the display too.display.init();display.flipScreenVertically();display.setFont(ArialMT_Plain_10);msa300_init();
}void drawFontFaceDemo() {
// Font Demo1// create more fonts at http://oleddisplay.squix.ch/display.setTextAlignment(TEXT_ALIGN_LEFT);display.setFont(ArialMT_Plain_10);display.drawString(0, 0, "Hello world");display.setFont(ArialMT_Plain_16);display.drawString(0, 10, "Hello world");display.setFont(ArialMT_Plain_24);display.drawString(0, 26, "Hello world");
}void drawTextFlowDemo() {
display.setFont(ArialMT_Plain_10);display.setTextAlignment(TEXT_ALIGN_LEFT);display.drawStringMaxWidth(0, 0, 128,"Lorem ipsum\n dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore." );
}void drawTextAlignmentDemo() {
// Text alignment demodisplay.setFont(ArialMT_Plain_10);// The coordinates define the left starting point of the textdisplay.setTextAlignment(TEXT_ALIGN_LEFT);display.drawString(0, 10, "Left aligned (0,10)");// The coordinates define the center of the textdisplay.setTextAlignment(TEXT_ALIGN_CENTER);display.drawString(64, 22, "Center aligned (64,22)");// The coordinates define the right end of the textdisplay.setTextAlignment(TEXT_ALIGN_RIGHT);display.drawString(128, 33, "Right aligned (128,33)");
}void drawRectDemo() {
// Draw a pixel at given positionfor (int i = 0; i < 10; i++) {
display.setPixel(i, i);display.setPixel(10 - i, i);}display.drawRect(12, 12, 20, 20);// Fill the rectangledisplay.fillRect(14, 14, 17, 17);// Draw a line horizontallydisplay.drawHorizontalLine(0, 40, 20);// Draw a line horizontallydisplay.drawVerticalLine(40, 0, 20);
}void drawCircleDemo() {
for (int i = 1; i < 8; i++) {
display.setColor(WHITE);display.drawCircle(32, 32, i * 3);if (i % 2 == 0) {
display.setColor(BLACK);}display.fillCircle(96, 32, 32 - i * 3);}
}void drawProgressBarDemo() {
int progress = (counter / 5) % 100;// draw the progress bardisplay.drawProgressBar(0, 32, 120, 10, progress);// draw the percentage as Stringdisplay.setTextAlignment(TEXT_ALIGN_CENTER);display.drawString(64, 15, String(progress) + "%");
}void drawImageDemo() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits);
}void drawImageDemo_lang() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits_lang);
}//WiFi_Logo_bits_1,WiFi_Logo_bits_2,WiFi_Logo_bits_3
void drawImageDemo_1() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits_1);
}void drawImageDemo_2() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits_2);
}void drawImageDemo_3() {
// see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesdisplay.drawXbm(0, 0, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits_3);
}// Demo demos[] = {drawFontFaceDemo, drawTextFlowDemo, drawTextAlignmentDemo, drawRectDemo, drawCircleDemo, drawProgressBarDemo, drawImageDemo};
Demo demos[] = {
drawImageDemo, drawImageDemo_lang, drawImageDemo_1, drawImageDemo_2, drawImageDemo_3};
int demoLength = (sizeof(demos) / sizeof(Demo));
long timeSinceLastModeSwitch = 0;void change_display_bmp(){
demoMode = (demoMode + 1) % demoLength;
// delay(2000);
}//int16_t x_old,x_new,y_old,y_new,z_old,z_new;
int16_t x_old = 0;
int16_t x_new = 0;
int16_t y_old = 0;
int16_t y_new = 0;
int16_t z_old = 0;
int16_t z_new = 0;//int16_t x_old,x_new,y_old,y_new,z_old,z_new;
//x_old = 0;
//x_new = 0;
//y_old = 0;
//y_new = 0;
//z_old = 0;
//z_new = 0;void get_msa300(){
//get msa xyz valuemsa.read(); // get X Y and Z data at once// Then print out the raw dataSerial.print("X: "); Serial.print(msa.x); Serial.print(" \tY: "); Serial.print(msa.y); Serial.print(" \tZ: "); Serial.print(msa.z); Serial.println();x_old = x_new;y_old = y_new;z_old = z_new;x_new = msa.x;y_new = msa.y;z_new = msa.z;Serial.print(x_old);Serial.print(" \t");Serial.print(x_new);Serial.print("; \t");Serial.print(y_old);Serial.print(" \t");Serial.print(y_new);Serial.print("; \t");Serial.print(z_old);Serial.print(" \t");Serial.print(z_new);Serial.print("; \t");Serial.println();
}void reset_old_value(){
msa.read();Serial.print("\nreset old value start\n");Serial.print("print y_old&y_new \t");Serial.print(y_old);Serial.print(" \t");Serial.print(y_new);Serial.print("; \t");x_old = msa.x;y_old = msa.y;z_old = msa.z;Serial.print("\nreset old value end\n");Serial.print("print y_old&y_new \t");Serial.print(y_old);Serial.print(" \t");Serial.print(y_new);Serial.print("; \t");
}void display_bmp(){
// 1. display// clear the displaydisplay.clear();// draw the current demo methoddemos[demoMode]();display.setFont(ArialMT_Plain_10);display.setTextAlignment(TEXT_ALIGN_RIGHT);//display.drawString(128, 54, String(millis()));// write the buffer to the displaydisplay.display();
}void loop() {
shili
// if (millis() - timeSinceLastModeSwitch > DEMO_DURATION) {
// demoMode = (demoMode + 1) % demoLength;
// timeSinceLastModeSwitch = millis();
// }
// counter++;
// delay(10);//2. get msa300 value get_msa300();Serial.print("print y_old&y_new \t");Serial.print(y_old);Serial.print(" \t");Serial.print(y_new);Serial.print("; \t");Serial.println();int16_t temp = y_new - y_old;Serial.print("temp");Serial.print(temp);Serial.println();//3. judge if change picture
// if (abs(temp) > MSA_Y_CHANGE_RANGE_MAX) if (temp > MSA_Y_CHANGE_RANGE_MAX){
//(abs(y_new) < 500)
// change_display_bmp();if( abs(y_new) < 500 ){
Serial.print("\nturn to 0\n");}else{
Serial.print("change_display_bmp left\n");if (demoMode == 0){
Serial.print("left end\n");}else{
demoMode = (demoMode - 1) % demoLength;}display_bmp();//delay(2000);//wait_device_stablereset_old_value();temp=0;}}else if (temp < MSA_Y_CHANGE_RANGE_MIN){
if( abs(y_new) < 500 ){
Serial.print("\nturn to 0\n");}else{
//(abs(y_new) < 500)Serial.print("change_display_bmp right\n");if (demoMode == demoLength-1){
Serial.print("right end\n");}else{
demoMode = (demoMode + 1) % demoLength;}display_bmp();//delay(2000);//wait_device_stablereset_old_value();temp=0;}}//wait device change picture until status is balancedelay(500);
// change_display_bmp();}
图片显示数据略,参见上一节
6 结果
这个是动态的显示,看后续有空再上传视频吧。
测试中会发现有的时候转动屏幕但是不切换图片,这可能还需要再调整延时以及水平阈值和转动阈值。
目前就先这样吧,如果转动后慢慢回正到水平,以及转动时快速且角度较大,最终呈现的效果会好点。但这样设定的两个细节就没啥意义了。