基于Arduino的公交车报站器
前言
课程设计需要制作一个公交车报站器。设计思路,在指定路线上记录站点的经纬度,使用GPS模块来获取经纬度触发程序播放预存的MP3格式的音乐,再将地理位置信息放在显示屏上。结合之前做的时钟,那就可以在未到站的情况下显示时间,到站的时候进行一个报站。
准备
- 材料
名称 | 数量 |
---|---|
Arduino uno开发板 | 1 |
DFPlay mini mp3模块 | 1 |
内存卡 | 1 |
GPS模块 | 1 |
1.44TFT显示屏 | 1 |
8Ω 1.5W 小喇叭 | 1 |
小面包板 | 1 |
杜邦线 | 若干 |
- Proteus 8软件
- Arduino IDE
硬件设计框图
原理图绘制
软件设计框图
语音MP3制作
MP3用百度提供的语音合成来制作,下载并放到SD卡根目录MP3文件中(自己建一个)。
MP3的命名格式用xxxx.mp3,0001代表第一首。
GPS模块采集经纬度
如何采集经纬度信息可以看这篇文章Arduino读取GPS模块。
接下来是采集各个站点的经纬度,我在学校设置了站点,代替公交车站点。将站点的经纬度信息记录下来,取到秒截至,相差1秒大概相差30几米,具体情况要根据当地的经纬度为准。为了提高响应的速度,我将各站点的经纬度范围增大。
经纬度从串口取出,用excel的分列和数据透视取出最大最小经纬度值,适当可以增加经纬度范围增大。
所需库
这些库都可以在Arduino IDE管理库能下载。
* Adafruit_GFX.h //TFT显示屏核心库
* Adafruit_ST7735.h //ST7355库
* TinyGPS++.h //GPS模块库
* DFPlayer_Mini_Mp3.h //MP3播放模块库
程序
时钟程序
详细可以看我这篇博客解决Arduino使用LCD屏幕制作电子时钟的问题,这次程序加入了年份计算。
void time(){
//时间计算
//tft.invertDisplay(0);//颜色翻转
second = (SECOND + seconds) % 60; //计算秒
m = (SECOND + seconds) / 60; //分钟进位
minute = (MINUTE + m) % 60; //计算分钟
h = (MINUTE + m) / 60; //小时进位
hour = (HOUR + h) % 24; //计算小时
d = (HOUR + h) / 24; //天数进位
//day = (DAY + d) /12; //计算天数
//显示时间
tft.setTextColor(ST7735_YELLOW);//设置字体颜色为黄色
tft.setTextSize(3);//设置字体大小
tft.setCursor(20,10);
hour_greater(); //显示小时
tft.print(":");
minute_greater();
tft.drawFastHLine(0, 40, 128, ST7735_WHITE);//横线
tft.setTextColor(ST7735_YELLOW);
tft.setTextSize(3);//设置字体大小
tft.setCursor(12,50);
week();//显示星期
tft.drawFastHLine(0, 80, 128, ST7735_WHITE);//横线
tft.setCursor(5,90);
tft.setTextSize(2);//设置字体大小
Year();
Month();
Day();
//tft.println("2019/12/7");//偷懒了
}
void minute_greater()
{
if(minute<10)
{
tft.print("0");
tft.print(minute);
}
else
{
tft.print(minute);
}
}
void hour_greater()
{
if(hour<10)
{
tft.print("0");
tft.print(hour);
}
else
{
tft.print(hour);
}
}
/ ** 显示星期 **/
void week()
{
int w = WEEK;
switch(w)
{
case 1:
tft.println("MONDAY");
break;
case 2:
tft.println("TUESDAY");
break;
case 3:
tft.println("WEDDAY");
break;
case 4:
tft.println("THUDAY");
break;
case 5:
tft.println("FRIDAY");
break;
case 6:
tft.println("SATDAY");
break;
case 7:
tft.println("SUNDAY");
break;
default:
break;
}
}
void modulation()
{
//刷屏调整时间
if(minute1<minute || (minute1==59&&minute==0))
{
tft.fillScreen(ST7735_BLACK);
minute1+=1;
if(minute1 == 60)
{
tft.fillScreen(ST7735_BLACK);
minute1=0;
}
}
else if(hour==0)
{
tft.fillScreen(ST7735_BLACK);
WEEK+=1;
if(WEEK==8)
{
tft.fillScreen(ST7735_BLACK);
WEEK=1;
}
}
}
void clock()
{
time();
seconds = millis()/1000; //millis()方法获得uno时间
modulation();
}
//区分当月的天数
int Days(int year, int month){
int days = 0;
if(month != 2){
switch(month){
case 1: case 3: case 5: case 7: case 8: case 10: case 12: days = 31; break;
case 4: case 6: case 9: case 11: days = 30; break;
}
}
else{ //闰年
if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
days = 29;
}
else{
days = 28;
}
}
return days;
}
/** 计算当月天数 */
void Day(){
int days = Days(year,month);
int days_up;
if(month == 1){
days_up = Days( year - 1, 12 );
} else{
days_up = Days( year, month - 1 );
}
day = (DAY + d) % days;
if(day == 0){
day = days;
}
if((DAY + d) == days + 1){
DAY -= days;
mon++;
}
if((DAY + d) == 0){
DAY += days_up;
mon--;
}
tft.print(day);
}
/** 计算月份 **/
void Month(){
month = ( MONTH + mon ) % 12;
if(month == 0){
month = 12;
//year = YEAR+1;
}
y = (MONTH + mon - 1) / 12;
tft.print(month);
tft.print("/");
}
/** 年份计算 **/
void Year(){
if (y == 1)
{
year = YEAR + 1;
tft.print(year);
tft.print("/");
}
else{
year = YEAR;
tft.print(year);
tft.print("/");
}
}
语音报站程序
void location_mp3()
{
while (ss.available() > 0)
{
gps.encode(ss.read()); //The encode() method encodes the string in the encoding format specified by encoding.
if (gps.location.isUpdated())
{
latitude = gps.location.lat(); //gps.location.lat() can export latitude
longitude = gps.location.lng();//gps.location.lng() can export latitude
float a=latitude;
float b=longitude;
tft.fillScreen(ST7735_BLACK);
tft.setTextColor(ST7735_YELLOW); //字体颜色
if ((a>=23.0352 && a<=23.0358) && (b>=114.4107 && b<=114.4113)) //宿舍
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(20,5);
tft.setTextSize(2);
tft.println("Location"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude:");
tft.println(b, 4);
mp3_play(9);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0366 && a<=23.0373) && (b>=114.410 && b<=114.41067)) //饭堂位置
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(3);
tft.println("Canteen"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(6);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.04 && a<=23.0410) && (b>=114.4105 && b<=114.4115)) //快递站
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(1);
tft.println("express station"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(7);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0393 && a<=23.0395) && (b>=114.4137 && b<=114.4139)) //图书馆
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("Library"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(3);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.036 && a<=23.046) && (b>=114.4167 && b<=114.4173)) //校门口
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("school gate"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(1);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=3 && a<=4) && (b>=3 && b<=4)) //电子楼暂未踩点
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("5 building"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(1);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0412 && a<=23.0424) && (b>=114.412 && b<=114.4163)) //双子星
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("5 building"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(2);
delay(5000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0404 && a<=23.0417) && (b>=114.4125 && b<=114.4135)) //旭日大楼
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("xuri building"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(4);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0412 && a<=23.0427) && (b>=114.4105 && b<=114.415)) //3号楼
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("3 building"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(8);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
}
}
}
完整程序
/*
* richowe
* bus station broadcaster
* program
*/
/*
* mp3 files
* 0001.mp3 : 惠州学院站 3s
* 0002.mp3 : 双子星站 2s
* 0003.mp3 : 图书馆站 2s
* 0004.mp3 : 旭日大楼站 2s
* 0005.mp3 : 电子楼站 2s
* 0006.mp3 : 中苑饭堂站 3s
* 0007.mp3 : 快递站 2s
* 0008.mp3 : 3号楼站 2s
* 0009.mp3 : 南苑5栋 3s
* 0010.mp3 :欢迎使用公交车报站器
*/
/*
* library function
* Adafruit_GFX.h
* Adafruit_ST7735.h
* TinyGPS++.h
* DFPlayer_Mini_Mp3.h
*/
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // 导入库函数
#include <TinyGPS++.h>
#include <DFPlayer_Mini_Mp3.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#define TFT_CS 10 //定义TFT接线引脚
#define TFT_RST 9
#define TFT_DC 8
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
#define TFT_SCLK 13
#define TFT_MOSI 11
TinyGPSPlus gps;
SoftwareSerial ss(4, 3);
unsigned long seconds;
int m = 0, h = 0, d = 0, mon = 0 , y = 0; //时间进位
int second = 0, minute = 0, hour = 0; //时间
int SECOND = 0, MINUTE = 00, HOUR = 8, WEEK = 3;//设置当前时间
int year = 0, month = 0, day = 0;
int YEAR = 2019, MONTH = 12, DAY = 18; //设置年月日
int minute1 = MINUTE; //调整时间
double latitude; //纬度
double longitude; //经度
void setup()
{
tft.initR(INITR_144GREENTAB); //初始化
Serial.begin(9600);//设置波特率
ss.begin(9600);
mp3_set_serial (Serial);
delay(1); //等待1ms
mp3_set_volume (25);
mp3_play(0010);
tft.fillScreen(ST7735_BLACK);//设置黑屏
tft.setRotation(2);//旋转屏幕180°
}
void loop()
{
if (ss.available() > 0) //判断是否到站
{
location_mp3();
}
else
{
//tft.fillScreen(ST7735_BLACK);//刷屏
clock();
}
}
void time(){
//时间计算
//tft.invertDisplay(0);//颜色翻转
second = (SECOND + seconds) % 60; //计算秒
m = (SECOND + seconds) / 60; //分钟进位
minute = (MINUTE + m) % 60; //计算分钟
h = (MINUTE + m) / 60; //小时进位
hour = (HOUR + h) % 24; //计算小时
d = (HOUR + h) / 24; //天数进位
//day = (DAY + d) /12; //计算天数
//显示时间
tft.setTextColor(ST7735_YELLOW);//设置字体颜色为黄色
tft.setTextSize(3);//设置字体大小
tft.setCursor(20,10);
hour_greater(); //显示小时
tft.print(":");
minute_greater();
tft.drawFastHLine(0, 40, 128, ST7735_WHITE);//横线
tft.setTextColor(ST7735_YELLOW);
tft.setTextSize(3);//设置字体大小
tft.setCursor(12,50);
week();//显示星期
tft.drawFastHLine(0, 80, 128, ST7735_WHITE);//横线
tft.setCursor(5,90);
tft.setTextSize(2);//设置字体大小
Year();
Month();
Day();
//tft.println("2019/12/7");//偷懒了
}
void minute_greater()
{
if(minute<10)
{
tft.print("0");
tft.print(minute);
}
else
{
tft.print(minute);
}
}
void hour_greater()
{
if(hour<10)
{
tft.print("0");
tft.print(hour);
}
else
{
tft.print(hour);
}
}
/ ** 显示星期 **/
void week()
{
int w = WEEK;
switch(w)
{
case 1:
tft.println("MONDAY");
break;
case 2:
tft.println("TUESDAY");
break;
case 3:
tft.println("WEDDAY");
break;
case 4:
tft.println("THUDAY");
break;
case 5:
tft.println("FRIDAY");
break;
case 6:
tft.println("SATDAY");
break;
case 7:
tft.println("SUNDAY");
break;
default:
break;
}
}
void modulation()
{
//刷屏调整时间
if(minute1<minute || (minute1==59&&minute==0))
{
tft.fillScreen(ST7735_BLACK);
minute1+=1;
if(minute1 == 60)
{
tft.fillScreen(ST7735_BLACK);
minute1=0;
}
}
else if(hour==0)
{
tft.fillScreen(ST7735_BLACK);
WEEK+=1;
if(WEEK==8)
{
tft.fillScreen(ST7735_BLACK);
WEEK=1;
}
}
}
void clock()
{
time();
seconds = millis()/1000; //millis()方法获得uno时间
modulation();
}
//区分当月的天数
int Days(int year, int month){
int days = 0;
if(month != 2){
switch(month){
case 1: case 3: case 5: case 7: case 8: case 10: case 12: days = 31; break;
case 4: case 6: case 9: case 11: days = 30; break;
}
}
else{ //闰年
if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
days = 29;
}
else{
days = 28;
}
}
return days;
}
/** 计算当月天数 */
void Day(){
int days = Days(year,month);
int days_up;
if(month == 1){
days_up = Days( year - 1, 12 );
} else{
days_up = Days( year, month - 1 );
}
day = (DAY + d) % days;
if(day == 0){
day = days;
}
if((DAY + d) == days + 1){
DAY -= days;
mon++;
}
if((DAY + d) == 0){
DAY += days_up;
mon--;
}
tft.print(day);
}
/** 计算月份 **/
void Month(){
month = ( MONTH + mon ) % 12;
if(month == 0){
month = 12;
//year = YEAR+1;
}
y = (MONTH + mon - 1) / 12;
tft.print(month);
tft.print("/");
}
/** 年份计算 **/
void Year(){
if (y == 1)
{
year = YEAR + 1;
tft.print(year);
tft.print("/");
}
else{
year = YEAR;
tft.print(year);
tft.print("/");
}
}
void location_mp3()
{
while (ss.available() > 0)
{
gps.encode(ss.read()); //The encode() method encodes the string in the encoding format specified by encoding.
if (gps.location.isUpdated())
{
latitude = gps.location.lat(); //gps.location.lat() can export latitude
longitude = gps.location.lng();//gps.location.lng() can export latitude
float a=latitude;
float b=longitude;
tft.fillScreen(ST7735_BLACK);
tft.setTextColor(ST7735_YELLOW); //字体颜色
if ((a>=23.0352 && a<=23.0358) && (b>=114.4107 && b<=114.4113)) //宿舍
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(20,5);
tft.setTextSize(2);
tft.println("Location"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude:");
tft.println(b, 4);
mp3_play(9);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0366 && a<=23.0373) && (b>=114.410 && b<=114.41067)) //饭堂位置
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(3);
tft.println("Canteen"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(6);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.04 && a<=23.0410) && (b>=114.4105 && b<=114.4115)) //快递站
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(1);
tft.println("express station"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(7);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0393 && a<=23.0395) && (b>=114.4137 && b<=114.4139)) //图书馆
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("Library"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(3);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.036 && a<=23.046) && (b>=114.4167 && b<=114.4173)) //校门口
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("school gate"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(1);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=3 && a<=4) && (b>=3 && b<=4)) //电子楼暂未踩点
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("5 building"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(1);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
c=1;
}
else if ((a>=23.0412 && a<=23.0424) && (b>=114.412 && b<=114.4163)) //双子星
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("5 building"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(2);
delay(5000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0404 && a<=23.0417) && (b>=114.4125 && b<=114.4135)) //旭日大楼
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("xuri building"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(4);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
else if ((a>=23.0412 && a<=23.0427) && (b>=114.4105 && b<=114.415)) //3号楼
{
tft.drawFastHLine(0, 0, 128, ST7735_WHITE);//横线
tft.drawFastHLine(0, 30, 128, ST7735_WHITE);//横线
tft.setCursor(0,5);
tft.setTextSize(2);
tft.println("3 building"); //显示位置
tft.setTextSize(2);
tft.setCursor(0,35);
tft.println("Latitude:"); //显示经纬度信息
tft.println(a, 4); //显示到s
tft.print("Longitude");
tft.println(b, 4);
mp3_play(8);
delay(6000);
tft.fillScreen(ST7735_BLACK); //刷新
}
}
}
}
实物展示
先放图片,演示视频还在制作中,改天放Arduino社区去。
总结
- 完善时钟程序,获取GPS的UTS时间进行转换,更新当前时间
- 可以加入掉电保护程序和低功耗程序
- 可以使用OLED,利用U8g2库显示中文
- 增加上行和下行线路
- 增加FM收音功能
- 增加广告
- 联网,播报天气预报