您现在的位置是:首页 >技术杂谈 >基于arduino的实时地理景观介绍仪器网站首页技术杂谈

基于arduino的实时地理景观介绍仪器

珞珈第一深情 2024-06-17 10:14:52
简介基于arduino的实时地理景观介绍仪器

前言

在这里分享一下武汉大学校赛获奖作品樱花解说员的具体实现过程,特别感谢两位队友在比赛期间的努力。

一、主要设备及编译环境

1.NEO-6M GPS
2.JQ8900语音播报模块
3.七角OLED模块
4.arduino uno R3开发板
5.Arduino IDE编译环境

二、准备工作

1.利用PCtoLCD将所需的汉字转化为LCD模块所需的点阵字模。
2.将JQ8900模块与电脑连接,拷贝多个音频,并以命名区分,如00001等。
3.OLED的连接请参照OLED介绍
4.JQ8900的连接请参考JQ8900介绍
5.NEO-6M的连接请参考NEO-6M介绍

三、代码部分

#include <SoftwareSerial.h>             // 引用串口通信库
#include <TinyGPS++.h>                  // 引用GPS库
#include "U8glib.h"                     //引用U8glib库
int buttonState1 = 0;                   //记录按钮1的状态
int buttonState2 = 0;                   //记录按钮2的状态
int buttonPin1 = 6;                     //按钮1连到数字引脚6号
int buttonPin2 = 7;                     //按钮1连到数字引脚7号
static const int RXPin = 2, TXPin = 3;  //设置uno开发板的RX为2,TX为3
static const uint32_t GPSBaud = 9600;   //设置串口速率为9600
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);                                                                                                                                     //初始化RX,TX
U8GLIB_SSD1306_128X64 u8g(10, 9, 12, 11);                                                                                                                            //q初始化七角oled连接引脚:DO = 10, D1 = 9, CS = 12, DC = 11,RES=RESET                                                                                                                         //q初始化七角oled连接引脚:DO = 10, D1 = 9, CS = 12, DC = 11,RES=RESET
const double loc[5][2] = { { 30.531185, 114.355682 }, { 30.531406, 114.357124 }, { 30.533339, 114.358238 }, { 114.363066, 30.536759 }, { 114.363896, 30.539618 } };  //地理位置                                                                                                      //地点名
int i;                                                                                                                                                               //作为一个模块之间信息传递的标号
int j;
double d[5];
int mindis = 1000000;  //作为一个传递给i信息的循环标号
int visited[5] = { 0 };
static const unsigned char spacestr[1][16] PROGMEM =
{
  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*" ",0*/
};
static const unsigned char str2[4][32] PROGMEM =  //储存第一个地点的oled显示信息
{
  { 0xFE, 0x3F, 0x40, 0x00, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x08, 0x08,
    0xF8, 0x0F, 0x10, 0x00, 0xF8, 0x0F, 0x14, 0x04, 0x22, 0x02, 0xC0, 0x01, 0x38, 0x0E, 0x07, 0x70
  }, /*"夏",0*/

  { 0x20, 0x00, 0xA4, 0x3F, 0xA4, 0x20, 0x24, 0x11, 0x24, 0x0A, 0x24, 0x04, 0x24, 0x1A, 0xA4, 0x61,
    0x20, 0x00, 0x80, 0x00, 0x80, 0x00, 0xFC, 0x1F, 0x80, 0x00, 0x80, 0x00, 0xFF, 0x7F, 0x00, 0x00
  }, /*"坚",1*/

  { 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0xFC, 0x1F, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10,
    0xFC, 0x1F, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0xFC, 0x1F, 0x04, 0x10
  }, /*"白",2*/

  { 0x90, 0x00, 0x90, 0x0F, 0x50, 0x08, 0xE8, 0x3F, 0x58, 0x24, 0x4C, 0x22, 0xCC, 0x3F, 0x0A, 0x01,
    0x89, 0x22, 0x68, 0x15, 0x88, 0x0C, 0x68, 0x16, 0x08, 0x15, 0x88, 0x24, 0x68, 0x45, 0x08, 0x02
  }, /*"像",3*/
};
static const unsigned char str1[4][32] PROGMEM =  //储存第二个地点的oled显示信息
{
  { 0x80, 0x00, 0x80, 0x00, 0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0x08, 0x08, 0xF4, 0x17, 0x83, 0x60,
    0x80, 0x00, 0xFC, 0x1F, 0x80, 0x00, 0x88, 0x08, 0x90, 0x08, 0x90, 0x04, 0xFF, 0x7F, 0x00, 0x00
  }, /*"金",0*/

  { 0x00, 0x00, 0xE2, 0x1F, 0x04, 0x08, 0x84, 0x05, 0x00, 0x02, 0xE0, 0x3F, 0x27, 0x22, 0x24, 0x22,
    0xE4, 0x3F, 0x24, 0x22, 0x24, 0x22, 0xE4, 0x3F, 0x24, 0x22, 0x24, 0x2A, 0x2A, 0x10, 0xF1, 0x7F
  }, /*"通",1*/

  { 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0x20, 0x08, 0x20, 0x08, 0xFF, 0x7F, 0x20, 0x08, 0x20, 0x08,
    0xFC, 0x0F, 0x20, 0x08, 0x20, 0x00, 0x10, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00
  }, /*"尹",2*/

  { 0x90, 0x00, 0x90, 0x0F, 0x50, 0x08, 0xE8, 0x3F, 0x58, 0x24, 0x4C, 0x22, 0xCC, 0x3F, 0x0A, 0x01,
    0x89, 0x22, 0x68, 0x15, 0x88, 0x0C, 0x68, 0x16, 0x08, 0x15, 0x88, 0x24, 0x68, 0x45, 0x08, 0x02
  }, /*"像",3*/
};
static const unsigned char str3[4][32] PROGMEM =
{
  { 0x00, 0x02, 0x00, 0x0A, 0xFC, 0x12, 0x00, 0x12, 0x00, 0x02, 0xFF, 0x7F, 0x00, 0x02, 0x20, 0x02,
    0x20, 0x02, 0xE4, 0x02, 0x24, 0x04, 0x24, 0x44, 0x24, 0x48, 0xE4, 0x51, 0x1F, 0x60, 0x02, 0x40
  },/*"武",0*/

  { 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xFF, 0x7F, 0x80, 0x00, 0x80, 0x00,
    0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, 0x08, 0x08, 0x04, 0x10, 0x03, 0x60
  },/*"大",1*/

  { 0x10, 0x02, 0x12, 0x01, 0x92, 0x3F, 0x92, 0x24, 0x92, 0x24, 0xBE, 0x3F, 0x82, 0x24, 0x82, 0x22,
    0x9E, 0x3F, 0x12, 0x09, 0x92, 0x08, 0xD2, 0x7F, 0x12, 0x08, 0x12, 0x08, 0x12, 0x08, 0x11, 0x08
  },/*"牌",2*/

  { 0x08, 0x02, 0x08, 0x04, 0x08, 0x04, 0xC8, 0x7F, 0x08, 0x01, 0x3F, 0x01, 0x08, 0x01, 0x08, 0x3F,
    0x08, 0x21, 0x08, 0x21, 0x08, 0x21, 0x38, 0x21, 0x87, 0x20, 0x82, 0x20, 0x40, 0x14, 0x20, 0x08
  },/*"坊",3*/
};
static const unsigned char str4[5][32] PROGMEM =
{
  { 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7F, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xE0, 0x0F, 0x20, 0x08,
    0x20, 0x08, 0x10, 0x08, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x08, 0x02, 0x05, 0x01, 0x02
  },/*"万",0*/

  { 0x08, 0x04, 0x08, 0x04, 0x08, 0x04, 0x08, 0x04, 0xBF, 0x7F, 0x08, 0x04, 0x0C, 0x0E, 0x1C, 0x0E,
    0x2A, 0x15, 0x0A, 0x15, 0x89, 0x24, 0x48, 0x44, 0x28, 0x04, 0x08, 0x04, 0x08, 0x04, 0x08, 0x04
  },/*"林",1*/

  { 0x04, 0x0A, 0x04, 0x12, 0xF4, 0x7F, 0x04, 0x02, 0xE4, 0x3F, 0x3F, 0x22, 0xE4, 0x3F, 0x24, 0x22,
    0xE4, 0x3F, 0x24, 0x22, 0x04, 0x10, 0xF4, 0x7F, 0x44, 0x10, 0x84, 0x10, 0x84, 0x14, 0x04, 0x08
  },/*"博",2*/

  { 0x08, 0x01, 0x08, 0x01, 0x0A, 0x01, 0x0A, 0x3F, 0xBE, 0x2A, 0x4A, 0x2A, 0x09, 0x2A, 0x08, 0x29,
    0x38, 0x29, 0x8F, 0x24, 0x4A, 0x24, 0x08, 0x22, 0x08, 0x22, 0x08, 0x21, 0x88, 0x14, 0x08, 0x08
  },/*"物",3*/

  { 0x04, 0x02, 0x04, 0x04, 0xC4, 0x7F, 0x5C, 0x40, 0x32, 0x20, 0x8A, 0x1F, 0x81, 0x10, 0x84, 0x10,
    0x84, 0x1F, 0x84, 0x00, 0x84, 0x00, 0x84, 0x3F, 0x94, 0x20, 0x8C, 0x20, 0x84, 0x3F, 0x80, 0x20
  },/*"馆",4*/
};
static const unsigned char str5[3][32] PROGMEM =
{
  { 0x40, 0x00, 0x40, 0x10, 0xFC, 0x0B, 0x40, 0x04, 0x40, 0x02, 0xFF, 0x7F, 0x80, 0x00, 0x40, 0x00,
    0x30, 0x08, 0x18, 0x07, 0xF4, 0x00, 0x12, 0x10, 0x11, 0x10, 0x10, 0x10, 0xE0, 0x1F, 0x00, 0x00
  },/*"老",0*/

  { 0x40, 0x00, 0x80, 0x00, 0xFE, 0x3F, 0x10, 0x04, 0x20, 0x02, 0xC0, 0x01, 0x38, 0x0E, 0x07, 0x70,
    0xF8, 0x0F, 0x40, 0x00, 0x20, 0x00, 0xFC, 0x1F, 0x24, 0x11, 0x24, 0x11, 0x24, 0x15, 0x04, 0x08
  },/*"斋",1*/

  { 0x80, 0x00, 0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0x0C, 0x18, 0xF3, 0x67, 0x80, 0x00, 0x80, 0x00,
    0xFC, 0x1F, 0x80, 0x00, 0x80, 0x00, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0xF8, 0x0F, 0x08, 0x08
  },/*"舍",2*/
};
static const unsigned char startstr[5][32] PROGMEM =
{
  { 0x00, 0x00, 0xC4, 0x3F, 0x48, 0x20, 0x48, 0x20, 0x41, 0x20, 0xC2, 0x3F, 0x52, 0x00, 0x50, 0x02,
    0x48, 0x22, 0x48, 0x12, 0x47, 0x0E, 0x44, 0x02, 0x24, 0x42, 0x24, 0x42, 0x14, 0x7C, 0x08, 0x00
  },/*"泥",0*/

  { 0x00, 0x01, 0x00, 0x01, 0x10, 0x01, 0x20, 0x01, 0x24, 0x01, 0x08, 0x01, 0x08, 0x01, 0x00, 0x01,
    0xFF, 0x7F, 0x80, 0x00, 0x80, 0x02, 0x40, 0x04, 0x20, 0x08, 0x10, 0x10, 0x0C, 0x20, 0x03, 0x20
  },/*"头",1*/

  { 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0xFE, 0x3F, 0x20, 0x00, 0x90, 0x00, 0x88, 0x00, 0x84, 0x00,
    0xFC, 0x1F, 0x80, 0x00, 0x80, 0x00, 0xFF, 0x7F, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00
  },/*"车",2*/

  { 0x20, 0x02, 0x70, 0x02, 0x1C, 0x02, 0x10, 0x02, 0x10, 0x02, 0xFF, 0x02, 0x10, 0x02, 0x10, 0x02,
    0x7C, 0x02, 0x44, 0x02, 0x44, 0x02, 0x44, 0x42, 0x44, 0x42, 0x7C, 0x42, 0x44, 0x7C, 0x00, 0x00
  },/*"乱",3*/

  { 0x10, 0x20, 0x10, 0x20, 0x28, 0x20, 0x48, 0x24, 0x84, 0x24, 0x02, 0x25, 0x7D, 0x24, 0x44, 0x24,
    0x44, 0x24, 0x44, 0x24, 0x54, 0x24, 0x24, 0x24, 0x04, 0x21, 0x04, 0x21, 0xF8, 0x29, 0x00, 0x10
  },/*"创",4*/
};
static const unsigned char str6[4][32] PROGMEM =
{
  { 0x08, 0x05, 0x08, 0x09, 0x08, 0x01, 0x88, 0x7F, 0xBF, 0x08, 0xC8, 0x08, 0xA8, 0x3F, 0x88, 0x08,
    0x98, 0x08, 0x8C, 0x3F, 0x8B, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x7F, 0x8A, 0x00, 0x84, 0x00
  },/*"推",0*/

  { 0x10, 0x04, 0x10, 0x04, 0xFF, 0x7F, 0x50, 0x04, 0x40, 0x00, 0xFE, 0x3F, 0x20, 0x00, 0x90, 0x1F,
    0x10, 0x08, 0x18, 0x04, 0xD4, 0x7F, 0x12, 0x04, 0x11, 0x04, 0x10, 0x04, 0x10, 0x05, 0x10, 0x02
  },/*"荐",1*/

  { 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x80, 0x00, 0xFF, 0x7F, 0x00, 0x00,
    0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0xF8, 0x0F, 0x80, 0x00, 0x84, 0x10, 0xA2, 0x20, 0x40, 0x00
  },/*"景",2*/

  { 0x00, 0x00, 0x80, 0x3F, 0x80, 0x20, 0xBF, 0x20, 0xA0, 0x24, 0xA0, 0x24, 0x92, 0x24, 0x94, 0x24,
    0x88, 0x24, 0x88, 0x2A, 0x14, 0x0A, 0x24, 0x09, 0x22, 0x09, 0x81, 0x48, 0x40, 0x48, 0x20, 0x70
  },/*"观",3*/
};

void draw6(void)  //oled绘制主动推荐
{
  u8g.drawXBMP(32, 20, 16, 16, str6[0]);
  u8g.drawXBMP(48, 20, 16, 16, str6[1]);
  u8g.drawXBMP(64, 20, 16, 16, str6[2]);
  u8g.drawXBMP(80, 20, 16, 16, str6[3]);
}

void startdraw(void)  //oled绘制函数3
{
  u8g.drawXBMP(24, 20, 16, 16, startstr[0]);
  u8g.drawXBMP(40, 20, 16, 16, startstr[1]);
  u8g.drawXBMP(56, 20, 16, 16, startstr[2]);
  u8g.drawXBMP(72, 20, 16, 16, startstr[3]);
  u8g.drawXBMP(88, 20, 16, 16, startstr[4]);
}
void draw1(void)  //oled绘制函数1
{
  u8g.drawXBMP(32, 20, 16, 16, str1[0]);
  u8g.drawXBMP(48, 20, 16, 16, str1[1]);
  u8g.drawXBMP(64, 20, 16, 16, str1[2]);
  u8g.drawXBMP(80, 20, 16, 16, str1[3]);
}
void draw2(void)  //oled绘制函数2
{
  u8g.drawXBMP(32, 20, 16, 16, str2[0]);
  u8g.drawXBMP(48, 20, 16, 16, str2[1]);
  u8g.drawXBMP(64, 20, 16, 16, str2[2]);
  u8g.drawXBMP(80, 20, 16, 16, str2[3]);
}
void draw3(void)  //oled绘制函数3
{
  u8g.drawXBMP(32, 20, 16, 16, str3[0]);
  u8g.drawXBMP(48, 20, 16, 16, str3[1]);
  u8g.drawXBMP(64, 20, 16, 16, str3[2]);
  u8g.drawXBMP(80, 20, 16, 16, str3[3]);
}
void draw4(void)  //oled绘制函数3
{
  u8g.drawXBMP(24, 20, 16, 16, str4[0]);
  u8g.drawXBMP(40, 20, 16, 16, str4[1]);
  u8g.drawXBMP(56, 20, 16, 16, str4[2]);
  u8g.drawXBMP(72, 20, 16, 16, str4[3]);
  u8g.drawXBMP(88, 20, 16, 16, str4[4]);
}
void draw5(void)  //oled绘制函数3
{
  u8g.drawXBMP(40, 20, 16, 16, str5[0]);
  u8g.drawXBMP(56, 20, 16, 16, str5[1]);
  u8g.drawXBMP(72, 20, 16, 16, str5[2]);
}
void drawspace(void)
{
  u8g.drawXBMP( 32, 20, 16, 16, spacestr[0]);
}
void SendData(char addr)  //JQ8900函数播报函数。
{
  digitalWrite(5, HIGH); /*开始拉高*/
  delayMicroseconds(1000);
  digitalWrite(5, LOW);       /*开始引导码*/
  delayMicroseconds(3200);    /*此处延时最少要大于2ms*/
  for (int i = 0; i < 8; i++) /*总共8位数据  */
  {
    digitalWrite(5, HIGH);
    if (addr & 0x01) /*3:1表示数据位1,每个位用两个脉冲表示  */
    {
      delayMicroseconds(600);
      digitalWrite(5, LOW);
      delayMicroseconds(200);
    } else /*1:3表示数据位0 ,每个位用两个脉冲表示  */
    {
      delayMicroseconds(200);
      digitalWrite(5, LOW);
      delayMicroseconds(600);
    }
    addr >>= 1;
  }
  digitalWrite(5, HIGH);
}
void setup() {
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);
  pinMode(5, OUTPUT);
  Serial.begin(9600);  // 初始化串口通信
  ss.begin(9600);
  u8g.firstPage();
  do {
    startdraw();
  } while (u8g.nextPage());
}
void loop() {
  buttonState1 = digitalRead(buttonPin1);
  if (buttonState1 == LOW) {
    for (int k = 0; k < 5; k++) {
      visited[k] = 0;
      u8g.firstPage();
      do {
        startdraw();
      } while (u8g.nextPage());
    }
  }
  if (ss.available() > 0) {
    gps.encode(ss.read());
    if (gps.location.isUpdated()) {
      Serial.print("Latitude= ");
      Serial.print(gps.location.lat(), 6);
      Serial.print(" Longitude= ");
      Serial.println(gps.location.lng(), 6);

      Serial.println("ok ");
      for (j = 0; j < 5; j++) {                                                                                 // 循环计算当前位置与三个目标位置的距离
        double d = TinyGPSPlus::distanceBetween(gps.location.lat(), gps.location.lng(), loc[j][0], loc[j][1]);  // 计算距离
        if (d < 20.0) {
          Serial.print(" distance = ");
          Serial.println(d, 6);
          i = j;
          if (visited[i] == 0) {

            if (i == 0) {
              u8g.firstPage();
              do {
                draw1();
              } while (u8g.nextPage());
              visited[i] = 1; // 如果距离小于20米
              SendData(0x0a);    //清空数字
              SendData(0x01);    //曲目号
              SendData(0x00);
              SendData(0x0b);    //选曲播放
              delay(2000);    //延时

              //发送0x01
              SendData(0x0a);
              SendData(0x01);
              SendData(0x0b);
              delay(2000);
            } else if (i == 1) {
              u8g.firstPage();
              do {
                draw2();
              } while (u8g.nextPage());
              visited[i] = 1; // 如果距离小于20米
              SendData(0x0a);    //清空数字
              SendData(0x01);    //曲目号
              SendData(0x00);
              SendData(0x0b);    //选曲播放
              delay(2000);    //延时

              //发送0x01
              SendData(0x0a);
              SendData(0x02);
              SendData(0x0b);
              delay(2000);
            }
            else if (i == 2) {
              u8g.firstPage();
              do {
                draw3();
              } while (u8g.nextPage());
              visited[i] = 1; // 如果距离小于20米
              SendData(0x0a);    //清空数字
              SendData(0x01);    //曲目号
              SendData(0x00);
              SendData(0x0b);    //选曲播放
              delay(2000);    //延时

              //发送0x01
              SendData(0x0a);
              SendData(0x03);
              SendData(0x0b);
              delay(2000);
            }
            else if (i == 3) {
              u8g.firstPage();
              do {
                draw4();
              } while (u8g.nextPage());
              visited[i] = 1; // 如果距离小于20米
              SendData(0x0a);    //清空数字
              SendData(0x01);    //曲目号
              SendData(0x00);
              SendData(0x0b);    //选曲播放
              delay(2000);    //延时

              //发送0x01
              SendData(0x0a);
              SendData(0x04);
              SendData(0x0b);
              delay(2000);
            }
            else if (i == 4) {
              u8g.firstPage();
              do {
                draw5();
              } while (u8g.nextPage());
              visited[i] = 1; // 如果距离小于20米
              SendData(0x0a);    //清空数字
              SendData(0x01);    //曲目号
              SendData(0x00);
              SendData(0x0b);    //选曲播放
              delay(2000);    //延时

              //发送0x01
              SendData(0x0a);
              SendData(0x05);
              SendData(0x0b);
              delay(2000);
            }
            break;
          }
        }
      }
      buttonState2 = digitalRead(buttonPin2);
      if (buttonState2 == LOW) {  //推荐功能
        Serial.println("no ");
        //mindis=100000;
        for (j = 0; j < 5; j++) {                                                                             // 循环计算当前位置与三个目标位置的距离
          d[j] = TinyGPSPlus::distanceBetween(gps.location.lat(), gps.location.lng(), loc[j][0], loc[j][1]);  // 计算距离
          if (d[j] < 1000 && visited[j] == 0) {                                                                   // 如果距离小于20米
            Serial.print(" distance = ");
            Serial.println(d[j], 6);
            if (d[j] < mindis) {
              mindis = d[j];
              i = j;

            }
          }
        }
        mindis = 10000;
        if (i == 0) {
          Serial.println("yes");
          u8g.firstPage();
          do {
            draw6();
          } while (u8g.nextPage());
          SendData(0x0a);    //清空数字
          SendData(0x01);    //曲目号
          SendData(0x00);
          SendData(0x0b);    //选曲播放
          delay(2000);    //延时

          //发送0x01
          SendData(0x0a);
          SendData(0x06);
          SendData(0x0b);
          delay(2000);
        } else if (i == 1) {
          Serial.println("yes2");
          u8g.firstPage();
          do {
            draw6();
          } while (u8g.nextPage());
          SendData(0x0a);    //清空数字
          SendData(0x01);    //曲目号
          SendData(0x00);
          SendData(0x0b);    //选曲播放
          delay(2000);    //延时

          //发送0x01
          SendData(0x0a);
          SendData(0x07);
          SendData(0x0b);
          delay(2000);
        } else if (i == 2) {
          Serial.println("yes2");
          u8g.firstPage();
          do {
            draw6();
          } while (u8g.nextPage());
          SendData(0x0a);    //清空数字
          SendData(0x01);    //曲目号
          SendData(0x00);
          SendData(0x0b);    //选曲播放
          delay(2000);    //延时

          //发送0x01
          SendData(0x0a);
          SendData(0x08);
          SendData(0x0b);
          delay(2000);
        } else if (i == 3) {
          Serial.println("yes2");
          u8g.firstPage();
          do {
            draw6();
          } while (u8g.nextPage());
          SendData(0x0a);    //清空数字
          SendData(0x01);    //曲目号
          SendData(0x00);
          SendData(0x0b);    //选曲播放
          delay(2000);    //延时

          //发送0x01
          SendData(0x0a);
          SendData(0x09);
          SendData(0x0b);
          delay(2000);
        }
        else if (i == 4) {
          Serial.println("yes2");
          u8g.firstPage();
          do {
            draw6();
          } while (u8g.nextPage());
          SendData(0x0a);    //清空数字
          SendData(0x01);    //曲目号
          SendData(0x00);
          SendData(0x0b);    //选曲播放
          delay(2000);    //延时

          //发送0x01
          SendData(0x0a);
          SendData(0x01);
          SendData(0x01);
          SendData(0x0b);
          delay(2000);


        }
      }
    }
  }
}

四、功能总结

1.完成自动播报所在位置的历史信息
2.一个按钮实现推荐下一个目标地
3.已去过的地方不会再次播报以及推荐
4.配备一个按钮可以对设备进行重新初始化

五、图片

包装后的外观

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。