为开发板编译时出错是什么原因-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

楼主: SMISH

[已解决] 为开发板编译时出错是什么原因

[复制链接]
发表于 2018-4-21 08:34 | 显示全部楼层
代码:
#include "U8glib.h"//引用U8G头文件
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);//设置设备名称:I2C-SSD1306-128*64(OLED)
//如果屏幕不同请自行修改 如果第一次使用u8glib并且遇到显示不正确,请自行修改u8g配置
/*=========================================================
                         位图
  =========================================================*/
//HWT
const uint8_t HWT[] PROGMEM = {0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x06, 0x33, 0x3c, 0x12, 0x8b, 0xe0, 0x89, 0x44, 0x42, 0x09, 0x49, 0x24, 0x12, 0x88, 0x80, 0x89, 0x44, 0x99, 0x02, 0x49, 0x3c, 0x1e, 0x88, 0x8c, 0x8f, 0x44, 0x99, 0x04, 0x49, 0x24, 0x12, 0xa8, 0x8c, 0x89, 0x54, 0x42, 0x08, 0x49, 0x24, 0x12, 0x50, 0x80, 0x89, 0x28, 0x66, 0x0f, 0x33, 0xbc, 0x12, 0x50, 0x80, 0xe9, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
//title
const uint8_t title[] PROGMEM = {0x00, 0x00, 0x00, 0x08, 0x00, 0x3f, 0xff, 0x02, 0x30, 0x00, 0x00, 0x80, 0x00, 0x3f, 0xfc, 0x03, 0xff, 0xf0, 0x3f, 0xff, 0x02, 0x33, 0xf8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x30, 0x83, 0x0f, 0xfb, 0x18, 0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x30, 0x83, 0x07, 0x33, 0x18, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0xff, 0xe0, 0x37, 0xf3, 0x02, 0x33, 0x18, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x30, 0x83, 0x03, 0xf3, 0xf8, 0x3f, 0xfe, 0x00, 0x7f, 0xff, 0x0f, 0xff, 0xf8, 0x21, 0xc3, 0x02, 0x33, 0x18, 0x00, 0x80, 0x00, 0x06, 0x20, 0x00, 0x31, 0x80, 0x2f, 0xfb, 0x03, 0x33, 0x18, 0xff, 0xff, 0x80, 0x06, 0x20, 0x01, 0xff, 0x80, 0x20, 0x03, 0x03, 0xf3, 0x18, 0x03, 0x40, 0x00, 0x06, 0x20, 0x01, 0xfe, 0x40, 0x27, 0xf3, 0x02, 0x33, 0xf8, 0x06, 0xc2, 0x00, 0x06, 0x20, 0x00, 0x38, 0x60, 0x26, 0x33, 0x0f, 0xfb, 0x18, 0x0e, 0x46, 0x00, 0x04, 0x20, 0x03, 0xff, 0xf0, 0x66, 0x33, 0x0f, 0xfb, 0x18, 0x3e, 0x7c, 0x00, 0x0c, 0x20, 0x03, 0x0c, 0x00, 0x66, 0x33, 0x02, 0x23, 0x18, 0x76, 0x38, 0x00, 0x18, 0x21, 0x80, 0xcc, 0xc0, 0x67, 0xf3, 0x06, 0x36, 0x18, 0x46, 0xd8, 0x00, 0x38, 0x31, 0x87, 0x8c, 0x70, 0x40, 0x03, 0x0c, 0x1e, 0x18, 0x07, 0x8f, 0x80, 0xf0, 0x3f, 0x06, 0x3c, 0x30, 0xc0, 0x1f, 0x08, 0x0c, 0x38, 0x07, 0x03, 0x80, 0x40, 0x00, 0x00, 0x10, 0x00, 0x40, 0x0e, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00};

//放射性
const uint8_t radiation[] PROGMEM = {0x00, 0x00, 0x0f, 0xf0, 0x1f, 0xe8, 0x27, 0xe4, 0x43, 0xc2, 0x43, 0x82, 0x03, 0x80, 0x02, 0x40, 0x7e, 0x7e, 0x7f, 0xfe, 0x7c, 0x7e, 0x7c, 0x3e, 0x38, 0x1c, 0x18, 0x18, 0x0c, 0x30, 0x00, 0x00};
//金属
const uint8_t Bmrtal[] PROGMEM = {0x00, 0x00, 0x03, 0xfe, 0x04, 0x06, 0x08, 0x0a, 0x10, 0x12, 0x3f, 0xe2, 0x20, 0x22, 0x20, 0x22, 0x20, 0x22, 0x60, 0x22, 0xa0, 0x24, 0x60, 0x29, 0xa0, 0x3a, 0x7f, 0xf5, 0xaa, 0xaa, 0x55, 0x54};
const uint8_t Element[] PROGMEM = {0x7f, 0xc0, 0x10, 0x01, 0x00, 0x1c, 0x80, 0x00, 0x00, 0x10, 0x03, 0xfc, 0x38, 0x80, 0x00, 0x01, 0xff, 0x02, 0x08, 0x09, 0x98, 0x00, 0x00, 0x10, 0x0d, 0x90, 0x3f, 0x18, 0xff, 0xc3, 0xff, 0x80, 0xe0, 0x18, 0x40, 0x1a, 0x00, 0xfe, 0x00, 0xc0, 0x18, 0x40, 0x12, 0x00, 0x33, 0x03, 0xfc, 0x1d, 0x50, 0x12, 0x01, 0xff, 0x8f, 0x04, 0x39, 0x48, 0x32, 0x00, 0x10, 0x01, 0x04, 0x2b, 0x48, 0x63, 0x21, 0x93, 0x01, 0xfc, 0x0a, 0x40, 0xc1, 0xe2, 0x30, 0x01, 0x04, 0x08, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
//元素名称
const uint8_t Relative[] PROGMEM = {0x7f, 0xe1, 0xff, 0x04, 0x40, 0x0b, 0xf0, 0x42, 0x00, 0x06, 0x06, 0x4c, 0x10, 0x30, 0x5f, 0xc0, 0x08, 0x02, 0x58, 0x34, 0x20, 0x50, 0x40, 0x10, 0x00, 0x40, 0x0c, 0xe0, 0x5f, 0xc0, 0x10, 0x0f, 0xfe, 0x1b, 0x18, 0x50, 0x43, 0xff, 0x80, 0x40, 0x3a, 0x00, 0x5f, 0xc0, 0x10, 0x00, 0x40, 0x2b, 0xf8, 0x42, 0x00, 0x10, 0x0f, 0xfe, 0x08, 0x40, 0x4a, 0xc0, 0x10, 0x00, 0x40, 0x08, 0x40, 0x92, 0x60, 0x10, 0x00, 0x40, 0x08, 0x40, 0xa6, 0x00, 0x70, 0x00, 0x40, 0x1f, 0xf8};
//相对质量
const uint8_t RM[] PROGMEM = {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xf0, 0x00, 0x81, 0xfe, 0x0f, 0xf8, 0x12, 0x11, 0xf0, 0x83, 0xb0, 0x0f, 0xf8, 0x7e, 0x10, 0x3f, 0xc3, 0xff, 0x0f, 0xf8, 0x33, 0xf0, 0x37, 0xc3, 0xfe, 0x18, 0x0c, 0x33, 0x11, 0xa0, 0x82, 0x30, 0x1f, 0xfc, 0x3e, 0x10, 0xec, 0x82, 0xfe, 0x0f, 0xf8, 0x77, 0xf0, 0x64, 0x82, 0x92, 0x0f, 0xf8, 0x52, 0x10, 0x64, 0x82, 0x92, 0x0f, 0xf8, 0x12, 0x10, 0xb0, 0x86, 0x3c, 0x00, 0x80, 0x13, 0xf1, 0x90, 0x86, 0x6e, 0x07, 0xf0, 0x13, 0x11, 0x03, 0x85, 0xc3, 0x1f, 0xfc};
//价态
const uint8_t VA[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xc0, 0x08, 0x01, 0xfc, 0x04, 0x38, 0x11, 0x80, 0x18, 0x00, 0x1f, 0xc1, 0xff, 0xc1, 0xfc, 0x09, 0xa0, 0x11, 0x81, 0xff, 0xc0, 0x10, 0x40, 0x7f, 0x01, 0x04, 0x09, 0x20, 0x22, 0x40, 0x14, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x19, 0x20, 0x26, 0x30, 0x22, 0x00, 0x7f, 0xf0, 0x7f, 0x07, 0xff, 0x19, 0xfc, 0x6c, 0x10, 0x73, 0x00, 0x24, 0x00, 0x00, 0x02, 0x40, 0x09, 0x20, 0x22, 0x41, 0x88, 0xc0, 0x3f, 0xe1, 0x00, 0x43, 0xfe, 0x09, 0x20, 0x22, 0x41, 0x00, 0x00, 0x3d, 0x41, 0x3e, 0x43, 0xd4, 0x09, 0x30, 0x22, 0x40, 0xac, 0x80, 0x26, 0xc1, 0x22, 0x42, 0x6c, 0x09, 0xd0, 0x22, 0x41, 0xa0, 0xc0, 0x7c, 0xc1, 0x3e, 0x47, 0xcc, 0x09, 0xdc, 0x24, 0x41, 0x21, 0x40, 0x05, 0x31, 0x00, 0xc0, 0x53, 0x08, 0x4c, 0x2c, 0x40, 0x3f, 0x00};
/*=========================================================
                      自定义按键
  =========================================================*/
#define UP 11//定义方向键上为Arduino上的11号引脚
#define DOWN 10//定义方向键上为Arduino上的10号引脚
#define LEFT 9//定义方向键上为Arduino上的9号引脚
#define RIGHT 8//定义方向键上为Arduino上的8号引脚
#define A 7//定义方向键上为Arduino上的7号引脚
#define B 6//定义方向键上为Arduino上的6号引脚
/*=========================================================
                         变量
  =========================================================*/
boolean metal;
boolean refresh = true;
byte EX = 0;
byte EY = 0; //当前显示位置
int Nx, Ny;
byte ZQ; //周期
byte x, y;
const  byte AM[10][18] PROGMEM = {  //排列方式
  {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2},
  {3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, 9, 10},
  {11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 17, 18},
  {19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
  {37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54},
  {55, 56, 0, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86},
  {87, 88, 0, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118},
  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  {0, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 0, 0},
  {0, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 0, 0}
};
const byte non[24] PROGMEM = {  //非金属
  1, 2,
  5, 6, 7, 8, 9, 10,
  14, 15, 16, 17, 18,
  33, 34, 33, 36,
  52, 53, 54,
  85, 86,
  117, 118,
};
const byte Radius[107] PROGMEM = {  //半径
  78, 100, 154, 113, 95, 86, 80, 66, 64, 100,
  191, 160, 143, 134, 130, 104, 162, 100, 234, 197, 164,
  145, 135, 127, 132, 127, 126, 124, 128, 139, 140, 140,
  150, 160, 111, 114, 250, 215, 180, 160, 148, 140, 135,
  132, 134, 137, 144, 157, 166, 158, 160, 170, 195, 133,
  271, 224, 184, 182, 183, 182, 163, 180, 204, 180, 178,
  177, 177, 176, 175, 194, 173, 159, 148, 141, 146, 134,
  136, 139, 144, 162, 173, 175, 170, 170, 153, 153, 153,
  153, 188, 180, 160, 155, 158, 164, 173, 142, 142, 142,
  142, 142, 142, 142, 142, 142, 142, 142, 142,
};
const byte mass[] PROGMEM = {  //相对质量
  10, 8, 40, 3, 69, 41, 90, 12, 10, 81, 12, 1, 14, 1,
  16, 0, 19, 00, 20, 18, 22, 99, 24, 31, 26, 98, 23, 9,
  30, 97, 32, 6, 35, 45, 39, 95, 39, 10, 40, 8, 44, 96,
  47, 87, 50, 94, 52, 0, 54, 94, 55, 85, 58, 93, 58, 69,
  63, 55, 65, 38, 69, 72, 72, 63, 74, 92, 78, 96, 79, 90,
  83, 80, 85, 47, 87, 62, 88, 91, 91, 22, 92, 91, 95, 96,
  98, 0, 10, 11, 10, 29, 10, 64, 10, 79, 11, 24, 11, 48,
  11, 87, 12, 18, 12, 76, 12, 69, 13, 13, 13, 29, 13, 73,
  13, 89, 14, 1, 14, 9, 14, 42, 14, 50, 15, 4, 15, 20,
  15, 73, 15, 89, 16, 25, 16, 49, 16, 73, 16, 89, 17, 31,
  17, 50, 17, 85, 18, 9, 18, 38, 18, 62, 19, 2, 19, 22,
  19, 51, 19, 70, 20, 6, 20, 44, 20, 72, 20, 90, 20, 90,
  21, 0, 22, 20, 22, 30, 22, 60, 22, 70, 23, 20, 23, 10,
  23, 80, 23, 70, 24, 40, 24, 30, 24, 70, 24, 70, 25, 10,
  25, 20, 25, 70, 25, 80, 25, 90, 26, 20, 26, 50, 26, 80,
  27, 10, 27, 00, 27, 70, 27, 60, 28, 10, 28, 00, 28, 50,
  28, 40, 28, 90, 28, 80, 29, 30, 29, 40, 29, 40, 30,
};
const  byte AC[118][7] PROGMEM = {  //结构
  {1, 0, 0, 0, 0, 0, 0},
  {2, 0, 0, 0, 0, 0, 0},
  {2, 1, 0, 0, 0, 0, 0},
  {2, 2, 0, 0, 0, 0, 0},
  {2, 3, 0, 0, 0, 0, 0},
  {2, 4, 0, 0, 0, 0, 0},
  {2, 5, 0, 0, 0, 0, 0},
  {2, 6, 0, 0, 0, 0, 0},
  {2, 7, 0, 0, 0, 0, 0},
  {2, 8, 0, 0, 0, 0, 0},
  {2, 8, 1, 0, 0, 0, 0},
  {2, 8, 2, 0, 0, 0, 0},
  {2, 8, 3, 0, 0, 0, 0},
  {2, 8, 4, 0, 0, 0, 0},
  {2, 8, 5, 0, 0, 0, 0},
  {2, 8, 6, 0, 0, 0, 0},
  {2, 8, 7, 0, 0, 0, 0},
  {2, 8, 8, 0, 0, 0, 0}, //18
  {2 , 8 , 8 , 1, 0, 0, 0},
  {2 , 8 , 8 , 2, 0, 0, 0},
  {2 , 8 , 9 , 2, 0, 0, 0},
  {2 , 8 , 10 , 2, 0, 0, 0},
  {2 , 8 , 11 , 2, 0, 0, 0},
  {2 , 8 , 13 , 1, 0, 0, 0},
  {2 , 8 , 13 , 2, 0, 0, 0},
  {2 , 8 , 14 , 2, 0, 0, 0},
  {2 , 8 , 15 , 2, 0, 0, 0},
  {2 , 8 , 16 , 2, 0, 0, 0},
  {2 , 8 , 18 , 1, 0, 0, 0},
  {2 , 8 , 18 , 2, 0, 0, 0},
  {2 , 8 , 18 , 3, 0, 0, 0},
  {2 , 8 , 18 , 4, 0, 0, 0},
  {2 , 8 , 18 , 5, 0, 0, 0},
  {2 , 8 , 18 , 6, 0, 0, 0},
  {2 , 8 , 18 , 7, 0, 0, 0},
  {2 , 8 , 18 , 8, 0, 0, 0,},
  {2 , 8 , 18 , 8 , 1, 0, 0},
  {2 , 8 , 18 , 8 , 2, 0, 0},
  {2 , 8 , 18 , 9 , 2, 0, 0},
  {2 , 8 , 18 , 10, 2, 0, 0},
  {2 , 8 , 18 , 12, 1, 0, 0},
  {2 , 8 , 18 , 13, 1, 0, 0},
  {2 , 8 , 18 , 13, 2, 0, 0},
  {2 , 8 , 18 , 15, 1, 0, 0},
  {2 , 8 , 18 , 16, 1, 0, 0},
  {2 , 8 , 18 , 18 , 0, 0, 0},
  {2 , 8 , 18 , 18 , 1 , 0, 0},
  {2 , 8 , 18 , 18 , 2 , 0, 0},
  {2 , 8 , 18 , 18 , 3 , 0, 0},
  {2 , 8 , 18 , 18 , 4 , 0, 0},
  {2 , 8 , 18 , 18 , 5 , 0, 0},
  {2 , 8 , 18 , 18 , 6 , 0, 0},
  {2 , 8 , 18 , 18 , 7 , 0, 0},
  {2 , 8 , 18 , 18 , 8 , 0, 0},
  {2 , 8 , 18 , 18 , 8 , 1, 0},
  {2 , 8 , 18 , 18 , 8 , 2, 0},
  {2 , 8 , 18 , 18 , 9 , 2, 0},
  {2 , 8 , 18 , 19 , 9 , 2, 0},
  {2 , 8 , 18 , 21 , 8 , 2, 0},
  {2 , 8 , 18 , 22 , 8 , 2, 0},
  {2 , 8 , 18 , 23 , 8 , 2, 0},
  {2 , 8 , 18 , 24 , 8 , 2, 0},
  {2 , 8 , 18 , 25 , 8 , 2, 0},
  {2 , 8 , 18 , 25 , 9 , 2, 0},
  {2 , 8 , 18 , 27 , 8 , 2, 0},
  {2 , 8 , 18 , 28 , 8 , 2, 0},
  {2 , 8 , 18 , 29 , 8 , 2, 0},
  {2 , 8 , 18 , 30 , 8 , 2, 0},
  {2 , 8 , 18 , 31 , 8 , 2, 0},
  {2 , 8 , 18 , 32 , 8 , 2, 0},
  {2 , 8 , 18 , 32 , 9 , 2, 0},
  {2 , 8 , 18 , 32 , 10, 2, 0}, //72
  {2 , 8 , 18 , 32 , 11, 2 , 0},
  {2 , 8 , 18 , 32 , 12, 2 , 0},
  {2 , 8 , 18 , 32 , 13, 2 , 0},
  {2 , 8 , 18 , 32 , 14, 2 , 0},
  {2 , 8 , 18 , 32 , 15, 2 , 0},
  {2 , 8 , 18 , 32 , 17, 1 , 0},
  {2 , 8 , 18 , 32 , 18, 1 , 0},
  {2 , 8 , 18 , 32 , 18, 2 , 0},
  {2 , 8 , 18 , 32 , 18, 3 , 0},
  {2 , 8 , 18 , 32 , 18, 4 , 0},
  {2 , 8 , 18 , 32 , 18, 5 , 0},
  {2 , 8 , 18 , 32 , 18, 6 , 0},
  {2 , 8 , 18 , 32 , 18, 7 , 0},
  {2 , 8 , 18 , 32 , 18, 8 , 0},
  {2 , 8 , 18 , 32 , 18, 8 , 1},
  {2 , 8 , 18 , 32 , 18, 8 , 2},
  {2 , 8 , 18 , 32 , 18, 9 , 2},
  {2 , 8 , 18 , 32 , 18, 10, 2},
  {2 , 8 , 18 , 32 , 20, 9 , 2},
  {2 , 8 , 18 , 32 , 21, 9 , 2},
  {2 , 8 , 18 , 32 , 22, 9 , 2},
  {2 , 8 , 18 , 32 , 24, 8 , 2},
  {2 , 8 , 18 , 32 , 25, 8 , 2},
  {2 , 8 , 18 , 32 , 25, 9 , 2},
  {2 , 8 , 18 , 32 , 27, 8 , 2},
  {2 , 8 , 18 , 32 , 28, 8 , 2},
  {2 , 8 , 18 , 32 , 29, 8 , 2},
  {2 , 8 , 18 , 32 , 30, 8 , 2},
  {2 , 8 , 18 , 32 , 31, 8 , 2},
  {2 , 8 , 18 , 32 , 32, 8 , 2},
  {2 , 8 , 18 , 32 , 32, 9 , 2},
  {2 , 8 , 18 , 32 , 32, 10, 2},
  {2 , 8 , 18 , 32 , 32, 11, 2},
  {0, 0, 0, 0, 0, 0, 0,},
  {0, 0, 0, 0, 0, 0, 0,},
  {0, 0, 0, 0, 0, 0, 0,}
};
//元素名称
const byte EN[354] PROGMEM = {72, 32, 32, 72, 101, 32, 76, 105, 32, 66, 101, 32, 66, 32, 32, 67, 32, 32, 78, 32, 32, 79, 32, 32, 70, 32, 32, 78, 101, 32, 78, 97, 32, 77, 103, 32, 65, 108, 32, 83, 105, 32, 80, 32, 32, 83, 32, 32, 67, 108, 32, 65, 114, 32, 75, 32, 32, 67, 97, 32, 83, 99, 32, 84, 105, 32, 86, 32, 32, 67, 114, 32, 77, 110, 32, 70, 101, 32, 67, 111, 32, 78, 105, 32, 67, 117, 32, 90, 110, 32, 71, 97, 32, 71, 101, 32, 65, 115, 32, 83, 101, 32, 66, 114, 32, 75, 114, 32, 82, 98, 32, 83, 114, 32, 89, 32, 32, 90, 114, 32, 78, 98, 32, 77, 111, 32, 84, 99, 42, 82, 117, 32, 82, 104, 32, 80, 100, 32, 65, 103, 32, 67, 100, 32, 73, 110, 32, 83, 110, 32, 83, 98, 32, 84, 101, 32, 73, 32, 32, 88, 101, 32, 67, 115, 32, 66, 97, 32, 76, 97, 32, 67, 101, 32, 80, 114, 32, 78, 100, 32, 80, 109, 32, 83, 109, 32, 69, 117, 32, 71, 100, 32, 84, 98, 32, 68, 121, 32, 72, 111, 32, 69, 114, 32, 84, 109, 32, 89, 98, 32, 76, 117, 32, 72, 102, 32, 84, 97, 32, 87, 32, 32, 82, 101, 32, 79, 115, 32, 73, 114, 32, 80, 116, 32, 65, 117, 32, 72, 103, 32, 84, 105, 32, 80, 98, 32, 66, 105, 32, 80, 111, 42, 65, 116, 42, 82, 110, 42, 70, 114, 42, 82, 97, 42, 65, 99, 42, 84, 104, 42, 80, 97, 42, 85, 32, 42, 78, 112, 42, 80, 117, 42, 65, 109, 42, 67, 109, 42, 66, 107, 42, 67, 102, 42, 69, 115, 42, 70, 109, 42, 77, 100, 42, 78, 111, 42, 76, 114, 42, 82, 102, 42, 68, 98, 42, 83, 103, 42, 66, 104, 42, 72, 115, 42, 77, 116, 42, 68, 115, 42, 82, 103, 42, 67, 110, 42, 78, 104, 42, 70, 108, 42, 77, 101, 42, 76, 118, 42, 84, 115, 42, 79, 103, 42,};
/*=========================================================
                     只循环一次
  =========================================================*/
void setup() {
  //串口通讯波特率设置
  //初始化按钮
  pinMode(UP, INPUT);//定义方向UP引脚状态
  pinMode(DOWN, INPUT);//定义方向DOWN引脚状态
  pinMode(LEFT, INPUT);//定义方向LEFT引脚状态
  pinMode(RIGHT, INPUT);//定义方向RIGHT引脚状态
  pinMode(A, INPUT);//定义按键A引脚状态
  pinMode(B, INPUT);//定义按键B引脚状态
  //启动动画
  for (int i = 63; i >= 46; i--) {
    u8g.firstPage();
    do {
      u8g.drawBitmapP(26, i, 9, 8, HWT);
      if (i == 46) u8g.drawBitmapP(15, 9, 13, 17, title);
    } while ( u8g.nextPage() );
  }
  delay(1000);
}
/*=========================================================
                     不停循环
  =========================================================*/
void loop() {
  /*=========================================================
                    按键输入
    =========================================================*/
  if (digitalRead(UP) == HIGH) {
    if (EY > 0) {
      EY--;
      refresh = true;
    }
  }
  if (digitalRead(DOWN) == HIGH) {
    if (EY < 9) {
      EY++;
      refresh = true;
    }
  }
  if (digitalRead(LEFT) == HIGH) {
    if (EX > 0) {
      EX--;
      refresh = true;
    }
  }
  if (digitalRead(RIGHT) == HIGH) {
    if (EX < 17) {
      EX++;
      refresh = true;
    }
  }

  if (digitalRead(A) == HIGH) {
    if (pgm_read_byte_near(&AM[EY][EX]) != 0) {
      refresh = true;
      show();
    } else {
      if (EX == 2 && EY == 5) {
        EX = 1;
        EY = 8;
        refresh = true;
      }
      if (EX == 2 && EY == 6) {
        EX = 1;
        EY = 9;
        refresh = true;
      }
      delay(200); //防止按键短时间触发两遍
    }
  }
  /*=========================================================
                    显示
    =========================================================*/
  if (refresh == true) {
    u8g.firstPage();
    do {
      DrawTable();
    } while ( u8g.nextPage() );
    refresh = false;
  }
}
/*=========================================================
                  渲染表格
  =========================================================*/
void DrawTable() {
  Nx = EX - 3;
  Ny = EY - 1;
  for (int y = 1; y <= 3; y++) {
    for (int x = 1; x <= 7; x++) {
      if (x == 4 && y == 2) {
        //处于选择位置 反色处理开始
        u8g.setColorIndex(1);
        u8g.drawBox(x * 16 - 1, y * 16 - 1, 17, 17); //白色背景
        u8g.setColorIndex(0);
      }
      if (Nx >= 0 && Ny >= 0 && Nx <= 17 && Ny <= 9) {
        u8g.setFont(u8g_font_u8glib_4);   //切换u8g_font_u8glib_4字体
        if (pgm_read_byte_near(&AM[Ny][Nx]) != 0) { //如果当前位置存在元素
          if (x == 4 && y == 2) {} else {
            u8g.drawFrame(x * 16 - 1, y * 16 - 1, 17, 17);  //画格子
          }
          u8g.setPrintPos(x * 16 + 1, y * 16 + 6);  //在坐标开始画
          u8g.print(pgm_read_byte_near(&AM[Ny][Nx]));   //原子序号
          //元素名称
          u8g.setPrintPos(x * 16 + 1, y * 16 + 6 + 8); //在坐标开始画 第1个字符
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[Ny][Nx])) - 3])); //元素名称
          u8g.setPrintPos(x * 16 + 1 + 5, y * 16 + 6 + 8); //在坐标开始画 第2个字符
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[Ny][Nx])) - 2])); //元素名称
          u8g.setPrintPos(x * 16 + 1 + 5 + 5, y * 16 + 6 + 8); //在坐标开始画 第3个字符
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[Ny][Nx])) - 1])); //元素名称
        } else {
          //判断是否为镧系和锕系
          if (Nx == 2 && Ny == 5) {
            if (x == 4 && y == 2) {} else {
              u8g.drawFrame(x * 16 - 1, y * 16 - 1, 17, 17);  //画格子
            }
            u8g.setPrintPos(x * 16 + 1, y * 16 + 10);  //在坐标开始画
            u8g.print("La X");
          } else {
            if (Nx == 2 && Ny == 6) {
              if (x == 4 && y == 2) {} else {
                u8g.drawFrame(x * 16 - 1, y * 16 - 1, 17, 17);  //画格子
              }
              u8g.setPrintPos(x * 16 + 1, y * 16 + 10);  //在坐标开始画
              u8g.print("Ac X");
            } else {
              //画背景
              u8g.drawLine(x * 16 + 3, y * 16 + 3, x * 16 + 12, y * 16 + 12);
              u8g.drawLine(x * 16 + 12, y * 16 + 3, x * 16 + 3, y * 16 + 12);
            }
          }
        }
        if (x == 4 && y == 2) {
          //处于选择位置 反色处理结束
          u8g.setColorIndex(1);
        }
      }
      Nx++;
    }
    //画周期
    if (Ny + 1 <= 7 && Ny + 1 > 0) {
      u8g.setFont(u8g_font_courB08);   //切换u8g_font_courB08字体
      u8g.setPrintPos(3, y * 16 + 11); //在坐标开始画
      u8g.print(Ny + 1);
    }
    Nx = EX - 3;
    Ny++;
  }
  if (EY <= 7) { //在镧系和锕系关闭族的显示
    //画族
    u8g.setFont(u8g_font_u8glib_4);   //切换u8g_font_u8glib_4字体
    u8g.setPrintPos(69 - EX * 16, 6); //在坐标开始画
    u8g.print(F("IA    IIA   IIIB  IVB   VB  VIB VIIB  VIII  VIII  VIII    IB    IIB   IIIA   IVA  VA"));
    if (EX >= 12) {
      //清除渲染错误区域
      u8g.setColorIndex(0);
      u8g.drawBox(64 - EX * 16, 0, 112, 14); //清空重绘区
      u8g.setColorIndex(1);
      //绘后半部分
      u8g.setPrintPos(48 - EX * 16, 6); //在坐标开始画
      u8g.print(F(" VIA  VIIA   0 "));
    }
    if (EX <= 3) {
      //清除渲染错误区域
      u8g.setColorIndex(0);
      u8g.drawBox(0, 0, 48 - EX * 16, 14); //清空重绘区
      u8g.setColorIndex(1);
    }
  }
}
/*=========================================================
                  详细资料
  =========================================================*/
void show() {
  byte p = 1;
  while (digitalRead(B) == LOW)
  {
    if (digitalRead(LEFT) == HIGH) {
      if (p > 1) {
        p--;
        refresh = true;
      }
    }
    if (digitalRead(RIGHT) == HIGH) {
      if (p < 3) {
        p++;
        refresh = true;
      }
    }
    if (refresh == true) {
      refresh = false;
      u8g.firstPage();
      do {
        if (p == 1) {
          //资料页
          u8g.setFont(u8g_font_10x20);
          u8g.setPrintPos(60, 14);
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[EY][EX])) - 3])); //元素名称
          u8g.setPrintPos(74, 14);
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[EY][EX])) - 2])); //元素名称
          u8g.setPrintPos(92, 14);
          //是否放射性
          if (pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[EY][EX])) - 1]) == 42) u8g.drawBitmapP(112, 19, 2, 16, radiation); //放射性图标
          //是否金属
          metal = true;
          for (int i = 0; i <= 23; i++) {
            if (pgm_read_byte_near(&non[i]) == pgm_read_byte_near(&AM[EY][EX])) {
              metal = false;
            }
          }
          if (metal == true) u8g.drawBitmapP(112, 36, 2, 16, Bmrtal); //金属图标
          u8g.print(pgm_read_byte_near(&AM[EY][EX]));   //原子序数
          u8g.setFont(u8g_font_tpssb);
          u8g.drawBitmapP(2, 1, 7, 11, Element);
          u8g.drawBitmapP(2, 21, 7, 11, Relative);
          u8g.drawBitmapP(1, 40, 7, 12, RM);
          u8g.setPrintPos(61, 30);
          if (pgm_read_byte_near(&AM[EY][EX]) < 108) {
            u8g.print(float(pgm_read_byte_near(&Radius[pgm_read_byte_near(&AM[EY][EX]) - 1])) / 100); //半径
          } else {
            u8g.print("?.???");
          }
          u8g.setPrintPos(61, 52);
          if (pgm_read_byte_near(&AM[EY][EX]) <= 4) {
            u8g.print(pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 2]) / float(10) + pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 1]) / float(1000), 3); //相对质量
          } else {
            if (pgm_read_byte_near(&AM[EY][EX]) <= 43) {
              u8g.print(pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 2]) + pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 1]) / float(100), 2); //相对质量
            } else {
              u8g.print(pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 2]) * 10 + pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 1]) / float(10), 1); //相对质量
            }
          }
          u8g.drawLine(0, 35, 128, 35);
          u8g.drawLine(0, 17, 128, 17);
        } else {
          if (p == 2) {
            //结构页
            //计算原子层数
            if (EY <= 7) {
              ZQ = EY;
            } else {
              if (EY == 8) {
                ZQ = 5;
              } else {
                if (EY == 9) {
                  ZQ = 6;
                }
              }
            }
            //46号不规则
            if (pgm_read_byte_near(&AM[EY][EX]) == 46) ZQ = 3;
            u8g.setFont(u8g_font_tpssb);
            u8g.drawDisc(11, 30, 16);  //画实心圆
            for (int i = 1; i <= ZQ + 1; i++) {
              u8g.drawCircle(11, 30, 12 + i * 15);   //渲染运行轨道
            }
            u8g.setColorIndex(0);
            //原子序数
            u8g.setPrintPos(-2, 35);
            u8g.print("+");
            u8g.setPrintPos(6, 35);
            u8g.print(pgm_read_byte_near(&AM[EY][EX]));
            u8g.drawBox(29, 26, 95, 13); //清理轨道
            u8g.setColorIndex(1);
            //标上电子数
            u8g.setFont(u8g_font_blipfest_07);
            for (int i = 0; i <= ZQ; i++) {
              u8g.setPrintPos(39 + i * 14, 34);
              if (pgm_read_byte_near(&AM[EY][EX]) < 105) {
                u8g.print(pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][i]));
              } else {
                u8g.print("?");
              }
            }
          } else {
            if (p == 3) {
              u8g.setFont(u8g_font_10x20);
              u8g.drawBitmapP(22, 1, 11, 12, VA);
              u8g.drawBox(0, 16, 128, 1);
              u8g.drawBox(64, 16, 1, 128);
              u8g.setPrintPos(16, 34);
              u8g.print("Max");
              u8g.setPrintPos(85, 34);
              u8g.print("Min");
              u8g.setPrintPos(27, 51);
              u8g.print(pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][ZQ]));   //打印最外层电子
              u8g.setPrintPos(95, 51);
              if (metal == true) {
                //金属没有负假
                u8g.print("0");
              } else {
                if (pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][ZQ]) >= 4 && (pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][ZQ]) != 8)) {
                  u8g.print(8 - pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][ZQ]));
                  u8g.setPrintPos(80, 51);
                  u8g.print("-");
                } else {
                  u8g.print("0");
                }
              }
            }
          }
        }
      } while ( u8g.nextPage() );
    }
  }
  refresh = true;  //返回后进行画面刷新
}
发表于 2018-4-21 08:35 | 显示全部楼层
[mw_shl_code=bash,true]#include "U8glib.h"//引用U8G头文件
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);//设置设备名称:I2C-SSD1306-128*64(OLED)
//如果屏幕不同请自行修改 如果第一次使用u8glib并且遇到显示不正确,请自行修改u8g配置
/*=========================================================
                         位图
  =========================================================*/
//HWT
const uint8_t HWT[] PROGMEM = {0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x06, 0x33, 0x3c, 0x12, 0x8b, 0xe0, 0x89, 0x44, 0x42, 0x09, 0x49, 0x24, 0x12, 0x88, 0x80, 0x89, 0x44, 0x99, 0x02, 0x49, 0x3c, 0x1e, 0x88, 0x8c, 0x8f, 0x44, 0x99, 0x04, 0x49, 0x24, 0x12, 0xa8, 0x8c, 0x89, 0x54, 0x42, 0x08, 0x49, 0x24, 0x12, 0x50, 0x80, 0x89, 0x28, 0x66, 0x0f, 0x33, 0xbc, 0x12, 0x50, 0x80, 0xe9, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
//title
const uint8_t title[] PROGMEM = {0x00, 0x00, 0x00, 0x08, 0x00, 0x3f, 0xff, 0x02, 0x30, 0x00, 0x00, 0x80, 0x00, 0x3f, 0xfc, 0x03, 0xff, 0xf0, 0x3f, 0xff, 0x02, 0x33, 0xf8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x30, 0x83, 0x0f, 0xfb, 0x18, 0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x30, 0x83, 0x07, 0x33, 0x18, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0xff, 0xe0, 0x37, 0xf3, 0x02, 0x33, 0x18, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x30, 0x83, 0x03, 0xf3, 0xf8, 0x3f, 0xfe, 0x00, 0x7f, 0xff, 0x0f, 0xff, 0xf8, 0x21, 0xc3, 0x02, 0x33, 0x18, 0x00, 0x80, 0x00, 0x06, 0x20, 0x00, 0x31, 0x80, 0x2f, 0xfb, 0x03, 0x33, 0x18, 0xff, 0xff, 0x80, 0x06, 0x20, 0x01, 0xff, 0x80, 0x20, 0x03, 0x03, 0xf3, 0x18, 0x03, 0x40, 0x00, 0x06, 0x20, 0x01, 0xfe, 0x40, 0x27, 0xf3, 0x02, 0x33, 0xf8, 0x06, 0xc2, 0x00, 0x06, 0x20, 0x00, 0x38, 0x60, 0x26, 0x33, 0x0f, 0xfb, 0x18, 0x0e, 0x46, 0x00, 0x04, 0x20, 0x03, 0xff, 0xf0, 0x66, 0x33, 0x0f, 0xfb, 0x18, 0x3e, 0x7c, 0x00, 0x0c, 0x20, 0x03, 0x0c, 0x00, 0x66, 0x33, 0x02, 0x23, 0x18, 0x76, 0x38, 0x00, 0x18, 0x21, 0x80, 0xcc, 0xc0, 0x67, 0xf3, 0x06, 0x36, 0x18, 0x46, 0xd8, 0x00, 0x38, 0x31, 0x87, 0x8c, 0x70, 0x40, 0x03, 0x0c, 0x1e, 0x18, 0x07, 0x8f, 0x80, 0xf0, 0x3f, 0x06, 0x3c, 0x30, 0xc0, 0x1f, 0x08, 0x0c, 0x38, 0x07, 0x03, 0x80, 0x40, 0x00, 0x00, 0x10, 0x00, 0x40, 0x0e, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00};

//放射性
const uint8_t radiation[] PROGMEM = {0x00, 0x00, 0x0f, 0xf0, 0x1f, 0xe8, 0x27, 0xe4, 0x43, 0xc2, 0x43, 0x82, 0x03, 0x80, 0x02, 0x40, 0x7e, 0x7e, 0x7f, 0xfe, 0x7c, 0x7e, 0x7c, 0x3e, 0x38, 0x1c, 0x18, 0x18, 0x0c, 0x30, 0x00, 0x00};
//金属
const uint8_t Bmrtal[] PROGMEM = {0x00, 0x00, 0x03, 0xfe, 0x04, 0x06, 0x08, 0x0a, 0x10, 0x12, 0x3f, 0xe2, 0x20, 0x22, 0x20, 0x22, 0x20, 0x22, 0x60, 0x22, 0xa0, 0x24, 0x60, 0x29, 0xa0, 0x3a, 0x7f, 0xf5, 0xaa, 0xaa, 0x55, 0x54};
const uint8_t Element[] PROGMEM = {0x7f, 0xc0, 0x10, 0x01, 0x00, 0x1c, 0x80, 0x00, 0x00, 0x10, 0x03, 0xfc, 0x38, 0x80, 0x00, 0x01, 0xff, 0x02, 0x08, 0x09, 0x98, 0x00, 0x00, 0x10, 0x0d, 0x90, 0x3f, 0x18, 0xff, 0xc3, 0xff, 0x80, 0xe0, 0x18, 0x40, 0x1a, 0x00, 0xfe, 0x00, 0xc0, 0x18, 0x40, 0x12, 0x00, 0x33, 0x03, 0xfc, 0x1d, 0x50, 0x12, 0x01, 0xff, 0x8f, 0x04, 0x39, 0x48, 0x32, 0x00, 0x10, 0x01, 0x04, 0x2b, 0x48, 0x63, 0x21, 0x93, 0x01, 0xfc, 0x0a, 0x40, 0xc1, 0xe2, 0x30, 0x01, 0x04, 0x08, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
//元素名称
const uint8_t Relative[] PROGMEM = {0x7f, 0xe1, 0xff, 0x04, 0x40, 0x0b, 0xf0, 0x42, 0x00, 0x06, 0x06, 0x4c, 0x10, 0x30, 0x5f, 0xc0, 0x08, 0x02, 0x58, 0x34, 0x20, 0x50, 0x40, 0x10, 0x00, 0x40, 0x0c, 0xe0, 0x5f, 0xc0, 0x10, 0x0f, 0xfe, 0x1b, 0x18, 0x50, 0x43, 0xff, 0x80, 0x40, 0x3a, 0x00, 0x5f, 0xc0, 0x10, 0x00, 0x40, 0x2b, 0xf8, 0x42, 0x00, 0x10, 0x0f, 0xfe, 0x08, 0x40, 0x4a, 0xc0, 0x10, 0x00, 0x40, 0x08, 0x40, 0x92, 0x60, 0x10, 0x00, 0x40, 0x08, 0x40, 0xa6, 0x00, 0x70, 0x00, 0x40, 0x1f, 0xf8};
//相对质量
const uint8_t RM[] PROGMEM = {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xf0, 0x00, 0x81, 0xfe, 0x0f, 0xf8, 0x12, 0x11, 0xf0, 0x83, 0xb0, 0x0f, 0xf8, 0x7e, 0x10, 0x3f, 0xc3, 0xff, 0x0f, 0xf8, 0x33, 0xf0, 0x37, 0xc3, 0xfe, 0x18, 0x0c, 0x33, 0x11, 0xa0, 0x82, 0x30, 0x1f, 0xfc, 0x3e, 0x10, 0xec, 0x82, 0xfe, 0x0f, 0xf8, 0x77, 0xf0, 0x64, 0x82, 0x92, 0x0f, 0xf8, 0x52, 0x10, 0x64, 0x82, 0x92, 0x0f, 0xf8, 0x12, 0x10, 0xb0, 0x86, 0x3c, 0x00, 0x80, 0x13, 0xf1, 0x90, 0x86, 0x6e, 0x07, 0xf0, 0x13, 0x11, 0x03, 0x85, 0xc3, 0x1f, 0xfc};
//价态
const uint8_t VA[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xc0, 0x08, 0x01, 0xfc, 0x04, 0x38, 0x11, 0x80, 0x18, 0x00, 0x1f, 0xc1, 0xff, 0xc1, 0xfc, 0x09, 0xa0, 0x11, 0x81, 0xff, 0xc0, 0x10, 0x40, 0x7f, 0x01, 0x04, 0x09, 0x20, 0x22, 0x40, 0x14, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x19, 0x20, 0x26, 0x30, 0x22, 0x00, 0x7f, 0xf0, 0x7f, 0x07, 0xff, 0x19, 0xfc, 0x6c, 0x10, 0x73, 0x00, 0x24, 0x00, 0x00, 0x02, 0x40, 0x09, 0x20, 0x22, 0x41, 0x88, 0xc0, 0x3f, 0xe1, 0x00, 0x43, 0xfe, 0x09, 0x20, 0x22, 0x41, 0x00, 0x00, 0x3d, 0x41, 0x3e, 0x43, 0xd4, 0x09, 0x30, 0x22, 0x40, 0xac, 0x80, 0x26, 0xc1, 0x22, 0x42, 0x6c, 0x09, 0xd0, 0x22, 0x41, 0xa0, 0xc0, 0x7c, 0xc1, 0x3e, 0x47, 0xcc, 0x09, 0xdc, 0x24, 0x41, 0x21, 0x40, 0x05, 0x31, 0x00, 0xc0, 0x53, 0x08, 0x4c, 0x2c, 0x40, 0x3f, 0x00};
/*=========================================================
                      自定义按键
  =========================================================*/
#define UP 11//定义方向键上为Arduino上的11号引脚
#define DOWN 10//定义方向键上为Arduino上的10号引脚
#define LEFT 9//定义方向键上为Arduino上的9号引脚
#define RIGHT 8//定义方向键上为Arduino上的8号引脚
#define A 7//定义方向键上为Arduino上的7号引脚
#define B 6//定义方向键上为Arduino上的6号引脚
/*=========================================================
                         变量
  =========================================================*/
boolean metal;
boolean refresh = true;
byte EX = 0;
byte EY = 0; //当前显示位置
int Nx, Ny;
byte ZQ; //周期
byte x, y;
const  byte AM[10][18] PROGMEM = {  //排列方式
  {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2},
  {3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, 9, 10},
  {11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 17, 18},
  {19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
  {37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54},
  {55, 56, 0, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86},
  {87, 88, 0, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118},
  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  {0, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 0, 0},
  {0, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 0, 0}
};
const byte non[24] PROGMEM = {  //非金属
  1, 2,
  5, 6, 7, 8, 9, 10,
  14, 15, 16, 17, 18,
  33, 34, 33, 36,
  52, 53, 54,
  85, 86,
  117, 118,
};
const byte Radius[107] PROGMEM = {  //半径
  78, 100, 154, 113, 95, 86, 80, 66, 64, 100,
  191, 160, 143, 134, 130, 104, 162, 100, 234, 197, 164,
  145, 135, 127, 132, 127, 126, 124, 128, 139, 140, 140,
  150, 160, 111, 114, 250, 215, 180, 160, 148, 140, 135,
  132, 134, 137, 144, 157, 166, 158, 160, 170, 195, 133,
  271, 224, 184, 182, 183, 182, 163, 180, 204, 180, 178,
  177, 177, 176, 175, 194, 173, 159, 148, 141, 146, 134,
  136, 139, 144, 162, 173, 175, 170, 170, 153, 153, 153,
  153, 188, 180, 160, 155, 158, 164, 173, 142, 142, 142,
  142, 142, 142, 142, 142, 142, 142, 142, 142,
};
const byte mass[] PROGMEM = {  //相对质量
  10, 8, 40, 3, 69, 41, 90, 12, 10, 81, 12, 1, 14, 1,
  16, 0, 19, 00, 20, 18, 22, 99, 24, 31, 26, 98, 23, 9,
  30, 97, 32, 6, 35, 45, 39, 95, 39, 10, 40, 8, 44, 96,
  47, 87, 50, 94, 52, 0, 54, 94, 55, 85, 58, 93, 58, 69,
  63, 55, 65, 38, 69, 72, 72, 63, 74, 92, 78, 96, 79, 90,
  83, 80, 85, 47, 87, 62, 88, 91, 91, 22, 92, 91, 95, 96,
  98, 0, 10, 11, 10, 29, 10, 64, 10, 79, 11, 24, 11, 48,
  11, 87, 12, 18, 12, 76, 12, 69, 13, 13, 13, 29, 13, 73,
  13, 89, 14, 1, 14, 9, 14, 42, 14, 50, 15, 4, 15, 20,
  15, 73, 15, 89, 16, 25, 16, 49, 16, 73, 16, 89, 17, 31,
  17, 50, 17, 85, 18, 9, 18, 38, 18, 62, 19, 2, 19, 22,
  19, 51, 19, 70, 20, 6, 20, 44, 20, 72, 20, 90, 20, 90,
  21, 0, 22, 20, 22, 30, 22, 60, 22, 70, 23, 20, 23, 10,
  23, 80, 23, 70, 24, 40, 24, 30, 24, 70, 24, 70, 25, 10,
  25, 20, 25, 70, 25, 80, 25, 90, 26, 20, 26, 50, 26, 80,
  27, 10, 27, 00, 27, 70, 27, 60, 28, 10, 28, 00, 28, 50,
  28, 40, 28, 90, 28, 80, 29, 30, 29, 40, 29, 40, 30,
};
const  byte AC[118][7] PROGMEM = {  //结构
  {1, 0, 0, 0, 0, 0, 0},
  {2, 0, 0, 0, 0, 0, 0},
  {2, 1, 0, 0, 0, 0, 0},
  {2, 2, 0, 0, 0, 0, 0},
  {2, 3, 0, 0, 0, 0, 0},
  {2, 4, 0, 0, 0, 0, 0},
  {2, 5, 0, 0, 0, 0, 0},
  {2, 6, 0, 0, 0, 0, 0},
  {2, 7, 0, 0, 0, 0, 0},
  {2, 8, 0, 0, 0, 0, 0},
  {2, 8, 1, 0, 0, 0, 0},
  {2, 8, 2, 0, 0, 0, 0},
  {2, 8, 3, 0, 0, 0, 0},
  {2, 8, 4, 0, 0, 0, 0},
  {2, 8, 5, 0, 0, 0, 0},
  {2, 8, 6, 0, 0, 0, 0},
  {2, 8, 7, 0, 0, 0, 0},
  {2, 8, 8, 0, 0, 0, 0}, //18
  {2 , 8 , 8 , 1, 0, 0, 0},
  {2 , 8 , 8 , 2, 0, 0, 0},
  {2 , 8 , 9 , 2, 0, 0, 0},
  {2 , 8 , 10 , 2, 0, 0, 0},
  {2 , 8 , 11 , 2, 0, 0, 0},
  {2 , 8 , 13 , 1, 0, 0, 0},
  {2 , 8 , 13 , 2, 0, 0, 0},
  {2 , 8 , 14 , 2, 0, 0, 0},
  {2 , 8 , 15 , 2, 0, 0, 0},
  {2 , 8 , 16 , 2, 0, 0, 0},
  {2 , 8 , 18 , 1, 0, 0, 0},
  {2 , 8 , 18 , 2, 0, 0, 0},
  {2 , 8 , 18 , 3, 0, 0, 0},
  {2 , 8 , 18 , 4, 0, 0, 0},
  {2 , 8 , 18 , 5, 0, 0, 0},
  {2 , 8 , 18 , 6, 0, 0, 0},
  {2 , 8 , 18 , 7, 0, 0, 0},
  {2 , 8 , 18 , 8, 0, 0, 0,},
  {2 , 8 , 18 , 8 , 1, 0, 0},
  {2 , 8 , 18 , 8 , 2, 0, 0},
  {2 , 8 , 18 , 9 , 2, 0, 0},
  {2 , 8 , 18 , 10, 2, 0, 0},
  {2 , 8 , 18 , 12, 1, 0, 0},
  {2 , 8 , 18 , 13, 1, 0, 0},
  {2 , 8 , 18 , 13, 2, 0, 0},
  {2 , 8 , 18 , 15, 1, 0, 0},
  {2 , 8 , 18 , 16, 1, 0, 0},
  {2 , 8 , 18 , 18 , 0, 0, 0},
  {2 , 8 , 18 , 18 , 1 , 0, 0},
  {2 , 8 , 18 , 18 , 2 , 0, 0},
  {2 , 8 , 18 , 18 , 3 , 0, 0},
  {2 , 8 , 18 , 18 , 4 , 0, 0},
  {2 , 8 , 18 , 18 , 5 , 0, 0},
  {2 , 8 , 18 , 18 , 6 , 0, 0},
  {2 , 8 , 18 , 18 , 7 , 0, 0},
  {2 , 8 , 18 , 18 , 8 , 0, 0},
  {2 , 8 , 18 , 18 , 8 , 1, 0},
  {2 , 8 , 18 , 18 , 8 , 2, 0},
  {2 , 8 , 18 , 18 , 9 , 2, 0},
  {2 , 8 , 18 , 19 , 9 , 2, 0},
  {2 , 8 , 18 , 21 , 8 , 2, 0},
  {2 , 8 , 18 , 22 , 8 , 2, 0},
  {2 , 8 , 18 , 23 , 8 , 2, 0},
  {2 , 8 , 18 , 24 , 8 , 2, 0},
  {2 , 8 , 18 , 25 , 8 , 2, 0},
  {2 , 8 , 18 , 25 , 9 , 2, 0},
  {2 , 8 , 18 , 27 , 8 , 2, 0},
  {2 , 8 , 18 , 28 , 8 , 2, 0},
  {2 , 8 , 18 , 29 , 8 , 2, 0},
  {2 , 8 , 18 , 30 , 8 , 2, 0},
  {2 , 8 , 18 , 31 , 8 , 2, 0},
  {2 , 8 , 18 , 32 , 8 , 2, 0},
  {2 , 8 , 18 , 32 , 9 , 2, 0},
  {2 , 8 , 18 , 32 , 10, 2, 0}, //72
  {2 , 8 , 18 , 32 , 11, 2 , 0},
  {2 , 8 , 18 , 32 , 12, 2 , 0},
  {2 , 8 , 18 , 32 , 13, 2 , 0},
  {2 , 8 , 18 , 32 , 14, 2 , 0},
  {2 , 8 , 18 , 32 , 15, 2 , 0},
  {2 , 8 , 18 , 32 , 17, 1 , 0},
  {2 , 8 , 18 , 32 , 18, 1 , 0},
  {2 , 8 , 18 , 32 , 18, 2 , 0},
  {2 , 8 , 18 , 32 , 18, 3 , 0},
  {2 , 8 , 18 , 32 , 18, 4 , 0},
  {2 , 8 , 18 , 32 , 18, 5 , 0},
  {2 , 8 , 18 , 32 , 18, 6 , 0},
  {2 , 8 , 18 , 32 , 18, 7 , 0},
  {2 , 8 , 18 , 32 , 18, 8 , 0},
  {2 , 8 , 18 , 32 , 18, 8 , 1},
  {2 , 8 , 18 , 32 , 18, 8 , 2},
  {2 , 8 , 18 , 32 , 18, 9 , 2},
  {2 , 8 , 18 , 32 , 18, 10, 2},
  {2 , 8 , 18 , 32 , 20, 9 , 2},
  {2 , 8 , 18 , 32 , 21, 9 , 2},
  {2 , 8 , 18 , 32 , 22, 9 , 2},
  {2 , 8 , 18 , 32 , 24, 8 , 2},
  {2 , 8 , 18 , 32 , 25, 8 , 2},
  {2 , 8 , 18 , 32 , 25, 9 , 2},
  {2 , 8 , 18 , 32 , 27, 8 , 2},
  {2 , 8 , 18 , 32 , 28, 8 , 2},
  {2 , 8 , 18 , 32 , 29, 8 , 2},
  {2 , 8 , 18 , 32 , 30, 8 , 2},
  {2 , 8 , 18 , 32 , 31, 8 , 2},
  {2 , 8 , 18 , 32 , 32, 8 , 2},
  {2 , 8 , 18 , 32 , 32, 9 , 2},
  {2 , 8 , 18 , 32 , 32, 10, 2},
  {2 , 8 , 18 , 32 , 32, 11, 2},
  {0, 0, 0, 0, 0, 0, 0,},
  {0, 0, 0, 0, 0, 0, 0,},
  {0, 0, 0, 0, 0, 0, 0,}
};
//元素名称
const byte EN[354] PROGMEM = {72, 32, 32, 72, 101, 32, 76, 105, 32, 66, 101, 32, 66, 32, 32, 67, 32, 32, 78, 32, 32, 79, 32, 32, 70, 32, 32, 78, 101, 32, 78, 97, 32, 77, 103, 32, 65, 108, 32, 83, 105, 32, 80, 32, 32, 83, 32, 32, 67, 108, 32, 65, 114, 32, 75, 32, 32, 67, 97, 32, 83, 99, 32, 84, 105, 32, 86, 32, 32, 67, 114, 32, 77, 110, 32, 70, 101, 32, 67, 111, 32, 78, 105, 32, 67, 117, 32, 90, 110, 32, 71, 97, 32, 71, 101, 32, 65, 115, 32, 83, 101, 32, 66, 114, 32, 75, 114, 32, 82, 98, 32, 83, 114, 32, 89, 32, 32, 90, 114, 32, 78, 98, 32, 77, 111, 32, 84, 99, 42, 82, 117, 32, 82, 104, 32, 80, 100, 32, 65, 103, 32, 67, 100, 32, 73, 110, 32, 83, 110, 32, 83, 98, 32, 84, 101, 32, 73, 32, 32, 88, 101, 32, 67, 115, 32, 66, 97, 32, 76, 97, 32, 67, 101, 32, 80, 114, 32, 78, 100, 32, 80, 109, 32, 83, 109, 32, 69, 117, 32, 71, 100, 32, 84, 98, 32, 68, 121, 32, 72, 111, 32, 69, 114, 32, 84, 109, 32, 89, 98, 32, 76, 117, 32, 72, 102, 32, 84, 97, 32, 87, 32, 32, 82, 101, 32, 79, 115, 32, 73, 114, 32, 80, 116, 32, 65, 117, 32, 72, 103, 32, 84, 105, 32, 80, 98, 32, 66, 105, 32, 80, 111, 42, 65, 116, 42, 82, 110, 42, 70, 114, 42, 82, 97, 42, 65, 99, 42, 84, 104, 42, 80, 97, 42, 85, 32, 42, 78, 112, 42, 80, 117, 42, 65, 109, 42, 67, 109, 42, 66, 107, 42, 67, 102, 42, 69, 115, 42, 70, 109, 42, 77, 100, 42, 78, 111, 42, 76, 114, 42, 82, 102, 42, 68, 98, 42, 83, 103, 42, 66, 104, 42, 72, 115, 42, 77, 116, 42, 68, 115, 42, 82, 103, 42, 67, 110, 42, 78, 104, 42, 70, 108, 42, 77, 101, 42, 76, 118, 42, 84, 115, 42, 79, 103, 42,};
/*=========================================================
                     只循环一次
  =========================================================*/
void setup() {
  //串口通讯波特率设置
  //初始化按钮
  pinMode(UP, INPUT);//定义方向UP引脚状态
  pinMode(DOWN, INPUT);//定义方向DOWN引脚状态
  pinMode(LEFT, INPUT);//定义方向LEFT引脚状态
  pinMode(RIGHT, INPUT);//定义方向RIGHT引脚状态
  pinMode(A, INPUT);//定义按键A引脚状态
  pinMode(B, INPUT);//定义按键B引脚状态
  //启动动画
  for (int i = 63; i >= 46; i--) {
    u8g.firstPage();
    do {
      u8g.drawBitmapP(26, i, 9, 8, HWT);
      if (i == 46) u8g.drawBitmapP(15, 9, 13, 17, title);
    } while ( u8g.nextPage() );
  }
  delay(1000);
}
/*=========================================================
                     不停循环
  =========================================================*/
void loop() {
  /*=========================================================
                    按键输入
    =========================================================*/
  if (digitalRead(UP) == HIGH) {
    if (EY > 0) {
      EY--;
      refresh = true;
    }
  }
  if (digitalRead(DOWN) == HIGH) {
    if (EY < 9) {
      EY++;
      refresh = true;
    }
  }
  if (digitalRead(LEFT) == HIGH) {
    if (EX > 0) {
      EX--;
      refresh = true;
    }
  }
  if (digitalRead(RIGHT) == HIGH) {
    if (EX < 17) {
      EX++;
      refresh = true;
    }
  }

  if (digitalRead(A) == HIGH) {
    if (pgm_read_byte_near(&AM[EY][EX]) != 0) {
      refresh = true;
      show();
    } else {
      if (EX == 2 && EY == 5) {
        EX = 1;
        EY = 8;
        refresh = true;
      }
      if (EX == 2 && EY == 6) {
        EX = 1;
        EY = 9;
        refresh = true;
      }
      delay(200); //防止按键短时间触发两遍
    }
  }
  /*=========================================================
                    显示
    =========================================================*/
  if (refresh == true) {
    u8g.firstPage();
    do {
      DrawTable();
    } while ( u8g.nextPage() );
    refresh = false;
  }
}
/*=========================================================
                  渲染表格
  =========================================================*/
void DrawTable() {
  Nx = EX - 3;
  Ny = EY - 1;
  for (int y = 1; y <= 3; y++) {
    for (int x = 1; x <= 7; x++) {
      if (x == 4 && y == 2) {
        //处于选择位置 反色处理开始
        u8g.setColorIndex(1);
        u8g.drawBox(x * 16 - 1, y * 16 - 1, 17, 17); //白色背景
        u8g.setColorIndex(0);
      }
      if (Nx >= 0 && Ny >= 0 && Nx <= 17 && Ny <= 9) {
        u8g.setFont(u8g_font_u8glib_4);   //切换u8g_font_u8glib_4字体
        if (pgm_read_byte_near(&AM[Ny][Nx]) != 0) { //如果当前位置存在元素
          if (x == 4 && y == 2) {} else {
            u8g.drawFrame(x * 16 - 1, y * 16 - 1, 17, 17);  //画格子
          }
          u8g.setPrintPos(x * 16 + 1, y * 16 + 6);  //在坐标开始画
          u8g.print(pgm_read_byte_near(&AM[Ny][Nx]));   //原子序号
          //元素名称
          u8g.setPrintPos(x * 16 + 1, y * 16 + 6 + 8); //在坐标开始画 第1个字符
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[Ny][Nx])) - 3])); //元素名称
          u8g.setPrintPos(x * 16 + 1 + 5, y * 16 + 6 + 8); //在坐标开始画 第2个字符
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[Ny][Nx])) - 2])); //元素名称
          u8g.setPrintPos(x * 16 + 1 + 5 + 5, y * 16 + 6 + 8); //在坐标开始画 第3个字符
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[Ny][Nx])) - 1])); //元素名称
        } else {
          //判断是否为镧系和锕系
          if (Nx == 2 && Ny == 5) {
            if (x == 4 && y == 2) {} else {
              u8g.drawFrame(x * 16 - 1, y * 16 - 1, 17, 17);  //画格子
            }
            u8g.setPrintPos(x * 16 + 1, y * 16 + 10);  //在坐标开始画
            u8g.print("La X");
          } else {
            if (Nx == 2 && Ny == 6) {
              if (x == 4 && y == 2) {} else {
                u8g.drawFrame(x * 16 - 1, y * 16 - 1, 17, 17);  //画格子
              }
              u8g.setPrintPos(x * 16 + 1, y * 16 + 10);  //在坐标开始画
              u8g.print("Ac X");
            } else {
              //画背景
              u8g.drawLine(x * 16 + 3, y * 16 + 3, x * 16 + 12, y * 16 + 12);
              u8g.drawLine(x * 16 + 12, y * 16 + 3, x * 16 + 3, y * 16 + 12);
            }
          }
        }
        if (x == 4 && y == 2) {
          //处于选择位置 反色处理结束
          u8g.setColorIndex(1);
        }
      }
      Nx++;
    }
    //画周期
    if (Ny + 1 <= 7 && Ny + 1 > 0) {
      u8g.setFont(u8g_font_courB08);   //切换u8g_font_courB08字体
      u8g.setPrintPos(3, y * 16 + 11); //在坐标开始画
      u8g.print(Ny + 1);
    }
    Nx = EX - 3;
    Ny++;
  }
  if (EY <= 7) { //在镧系和锕系关闭族的显示
    //画族
    u8g.setFont(u8g_font_u8glib_4);   //切换u8g_font_u8glib_4字体
    u8g.setPrintPos(69 - EX * 16, 6); //在坐标开始画
    u8g.print(F("IA    IIA   IIIB  IVB   VB  VIB VIIB  VIII  VIII  VIII    IB    IIB   IIIA   IVA  VA"));
    if (EX >= 12) {
      //清除渲染错误区域
      u8g.setColorIndex(0);
      u8g.drawBox(64 - EX * 16, 0, 112, 14); //清空重绘区
      u8g.setColorIndex(1);
      //绘后半部分
      u8g.setPrintPos(48 - EX * 16, 6); //在坐标开始画
      u8g.print(F(" VIA  VIIA   0 "));
    }
    if (EX <= 3) {
      //清除渲染错误区域
      u8g.setColorIndex(0);
      u8g.drawBox(0, 0, 48 - EX * 16, 14); //清空重绘区
      u8g.setColorIndex(1);
    }
  }
}
/*=========================================================
                  详细资料
  =========================================================*/
void show() {
  byte p = 1;
  while (digitalRead(B) == LOW)
  {
    if (digitalRead(LEFT) == HIGH) {
      if (p > 1) {
        p--;
        refresh = true;
      }
    }
    if (digitalRead(RIGHT) == HIGH) {
      if (p < 3) {
        p++;
        refresh = true;
      }
    }
    if (refresh == true) {
      refresh = false;
      u8g.firstPage();
      do {
        if (p == 1) {
          //资料页
          u8g.setFont(u8g_font_10x20);
          u8g.setPrintPos(60, 14);
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[EY][EX])) - 3])); //元素名称
          u8g.setPrintPos(74, 14);
          u8g.print((char)pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[EY][EX])) - 2])); //元素名称
          u8g.setPrintPos(92, 14);
          //是否放射性
          if (pgm_read_byte_near(&EN[(3 * pgm_read_byte_near(&AM[EY][EX])) - 1]) == 42) u8g.drawBitmapP(112, 19, 2, 16, radiation); //放射性图标
          //是否金属
          metal = true;
          for (int i = 0; i <= 23; i++) {
            if (pgm_read_byte_near(&non) == pgm_read_byte_near(&AM[EY][EX])) {
              metal = false;
            }
          }
          if (metal == true) u8g.drawBitmapP(112, 36, 2, 16, Bmrtal); //金属图标
          u8g.print(pgm_read_byte_near(&AM[EY][EX]));   //原子序数
          u8g.setFont(u8g_font_tpssb);
          u8g.drawBitmapP(2, 1, 7, 11, Element);
          u8g.drawBitmapP(2, 21, 7, 11, Relative);
          u8g.drawBitmapP(1, 40, 7, 12, RM);
          u8g.setPrintPos(61, 30);
          if (pgm_read_byte_near(&AM[EY][EX]) < 108) {
            u8g.print(float(pgm_read_byte_near(&Radius[pgm_read_byte_near(&AM[EY][EX]) - 1])) / 100); //半径
          } else {
            u8g.print("?.???");
          }
          u8g.setPrintPos(61, 52);
          if (pgm_read_byte_near(&AM[EY][EX]) <= 4) {
            u8g.print(pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 2]) / float(10) + pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 1]) / float(1000), 3); //相对质量
          } else {
            if (pgm_read_byte_near(&AM[EY][EX]) <= 43) {
              u8g.print(pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 2]) + pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 1]) / float(100), 2); //相对质量
            } else {
              u8g.print(pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 2]) * 10 + pgm_read_byte_near(&mass[2 * pgm_read_byte_near(&AM[EY][EX]) - 1]) / float(10), 1); //相对质量
            }
          }
          u8g.drawLine(0, 35, 128, 35);
          u8g.drawLine(0, 17, 128, 17);
        } else {
          if (p == 2) {
            //结构页
            //计算原子层数
            if (EY <= 7) {
              ZQ = EY;
            } else {
              if (EY == 8) {
                ZQ = 5;
              } else {
                if (EY == 9) {
                  ZQ = 6;
                }
              }
            }
            //46号不规则
            if (pgm_read_byte_near(&AM[EY][EX]) == 46) ZQ = 3;
            u8g.setFont(u8g_font_tpssb);
            u8g.drawDisc(11, 30, 16);  //画实心圆
            for (int i = 1; i <= ZQ + 1; i++) {
              u8g.drawCircle(11, 30, 12 + i * 15);   //渲染运行轨道
            }
            u8g.setColorIndex(0);
            //原子序数
            u8g.setPrintPos(-2, 35);
            u8g.print("+");
            u8g.setPrintPos(6, 35);
            u8g.print(pgm_read_byte_near(&AM[EY][EX]));
            u8g.drawBox(29, 26, 95, 13); //清理轨道
            u8g.setColorIndex(1);
            //标上电子数
            u8g.setFont(u8g_font_blipfest_07);
            for (int i = 0; i <= ZQ; i++) {
              u8g.setPrintPos(39 + i * 14, 34);
              if (pgm_read_byte_near(&AM[EY][EX]) < 105) {
                u8g.print(pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1]));
              } else {
                u8g.print("?");
              }
            }
          } else {
            if (p == 3) {
              u8g.setFont(u8g_font_10x20);
              u8g.drawBitmapP(22, 1, 11, 12, VA);
              u8g.drawBox(0, 16, 128, 1);
              u8g.drawBox(64, 16, 1, 128);
              u8g.setPrintPos(16, 34);
              u8g.print("Max");
              u8g.setPrintPos(85, 34);
              u8g.print("Min");
              u8g.setPrintPos(27, 51);
              u8g.print(pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][ZQ]));   //打印最外层电子
              u8g.setPrintPos(95, 51);
              if (metal == true) {
                //金属没有负假
                u8g.print("0");
              } else {
                if (pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][ZQ]) >= 4 && (pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][ZQ]) != 8)) {
                  u8g.print(8 - pgm_read_byte_near(&AC[pgm_read_byte_near(&AM[EY][EX]) - 1][ZQ]));
                  u8g.setPrintPos(80, 51);
                  u8g.print("-");
                } else {
                  u8g.print("0");
                }
              }
            }
          }
        }
      } while ( u8g.nextPage() );
    }
  }
  refresh = true;  //返回后进行画面刷新
}[/mw_shl_code]
发表于 2019-3-13 12:46 | 显示全部楼层
请问楼主是怎么解决的?谢谢~!
发表于 2019-8-13 18:11 | 显示全部楼层
同问同问同问同问同问同问同问
发表于 2019-8-13 22:20 | 显示全部楼层
这种问题经常发生在使用自编或者第三方类库的时候。可以在首选项里设置详细输出-编译看看具体是什么问题。
发表于 2019-8-15 10:03 | 显示全部楼层
jass 发表于 2018-4-21 08:33
我也是怎么办
Arduino:1.8.4 (Windows 7), 开发板:"Arduino/Genuino Uno"

没装u8g库
发表于 2019-8-15 13:22 来自手机 | 显示全部楼层
1间谍1jj,图个吉利益
发表于 2019-8-23 09:11 来自手机 | 显示全部楼层
我不www.Www.www.arduinoccandthewaytogetitisanew
发表于 2019-8-23 09:27 来自手机 | 显示全部楼层
const int ledPin = 13;
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 00:49 , Processed in 0.118579 second(s), 13 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表