banner

关爱我们的长辈——智能服药小帮手

icon
发布时间:2021-06-03
步骤1 作品主旨

爷爷奶奶奶们由于年龄大了,很多都有慢性病。现在我们国家发展和进步了,相应的医疗条件也好了,可以及时去医院进行治疗和控制,但我们看到医生给爷爷奶奶开了好多药,有的是降血压的,有的是降血脂的,有的是降血糖的,有五六种之多。药多了,有时爷爷奶奶会搞不清什么时候吃什么药,该吃多少剂量,会忘了每天有没按时服药。我们就想帮爷爷奶奶找一个可以进行服药管理的小设备。正好,我们正在利用业余时间学习初级的人工智能和物联网知识,因此,我们就设计了一个可以帮助爷爷奶奶进行智能服药管理的小帮手。

projectImage
projectImage
projectImage
步骤2 功能简介

1、闹钟提醒   通过定时闹钟,提醒服药人到服药时间了

2、服药人识别    区分服药人是谁,通过人工智能图像识别方法实现

3、测量体温    判断体温是否超过标准,通过红外测温方法实现

4、药物识别     判断是否是所需服用的药物,通过人工智能图像识别方法实现

5、语音和文字播报     进行语音和文字提示,通过语音播报和文字显示模块实现

6、记录服药情况   对每天服药情况进行记录,通过物联网模块进行上传实现

projectImage
硬件清单
1x
Arduino Mega 2560
2x
HuskyLens人工智能摄像头
3x
OLED显示屏
4x
syn6288语音合成模块
5x
红外线温度传感器
6x
小喇叭
7x
Arduino nano扩展板
8x
Gravity: UART OBLOQ - IoT物联网模块
9x
Gravity: I2C SD2405 RTC 实时时钟模块
步骤3 零件原始状态
projectImage
步骤4 组装摄像头、显示屏
projectImage
步骤5 组装喇叭和红外测温仪
projectImage
步骤6 组装按键计数器与物联网模块
projectImage
步骤7 组装时钟
projectImage
步骤8 组装进3D打印外壳中
projectImage

【硬件接线图】

projectImage
projectImage
projectImage
projectImage
步骤9 进行AI学习训练
projectImage
projectImage
projectImage
projectImage
projectImage
projectImage
步骤10 注册物联网

登录EasyIoT物联网平台(http://iot.dfrobot.com.cn/)完成用户注册及设备添加

projectImage

在程序中完成物联网参数设置

projectImage
步骤11 烧录上传程序到设备
projectImage
步骤12 进行测试使用(识别服药人、测量体温、识别药品、服药记录)

1、进行服药人识别,播报应服药品

projectImage

2、进行体温测量

projectImage

3、进行服用药品的识别

projectImage

4、进行服药情况的记录与上传

projectImage
步骤13 服药情况通过物联网上传记录,可随时查看
projectImage
代码
/*!
 * MindPlus
 * mega2560
 *
 */
#include <DFRobot_Obloq.h>
#include <DFRobot_DS0469.h>
#include <DFRobot_eeprom.h>
#include <DFRobot_SYN6288.h>
#include <DFRobot_MLX90614.h>
#include <DFRobot_HuskyLens.h>
#include <DFRobot_SSD1306_I2C.h>

// 动态变量
String         mind_s_DangQianYongHu, mind_s_Version;
volatile float mind_n_TiWenCeLiangChengGong, mind_n_TiWen, mind_n_debounce, mind_n_XuanYongYaoWu,
               mind_n_BanLanGenKeLiShiYongShuLiang, mind_n_GanMaoLingKeLiShiYongShuLiang,
               mind_n_PuDiLanKouFuYeShiYongShuLiang, mind_n_XiaoErNaMinKeLiShiYongShuLiang;
// 函数声明
void DF_beep(float mind_n_float);
void DF_NaoZhong();
void DF_CeLiangTiWen();
void DF_YaoWuShiBie();
void DF_YouJianChuShiHuaYaoWuLiang();
void DF_ChuShiHua();
void DF_RenLianShiBie();
void DF_ZuoJianYaoWuXuanZe();
// 静态常量
const chCode chBuf[] = {
	{0x4f53,0xe4bd93,0xCCE5,{0x08,0x40,0x08,0x40,0x08,0x40,0x10,0x40,0x17,0xfc,0x30,0x40,0x30,0xe0,0x50,0xe0,0x91,0x50,0x11,0x50,0x12,0x48,0x15,0xf4,0x18,0x42,0x10,0x40,0x10,0x40,0x10,0x40}},
	{0x6e29,0xe6b8a9,0xCEC2,{0x00,0x00,0x23,0xf8,0x12,0x08,0x12,0x08,0x83,0xf8,0x42,0x08,0x42,0x08,0x13,0xf8,0x10,0x00,0x27,0xfc,0xe4,0xa4,0x24,0xa4,0x24,0xa4,0x24,0xa4,0x2f,0xfe,0x00,0x00}},
	{0xff1a,0xefbc9a,0xA3BA,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00}},
	{0x5ea6,0xe5baa6,0xB6C8,{0x01,0x00,0x00,0x80,0x3f,0xfe,0x22,0x20,0x22,0x20,0x3f,0xfc,0x22,0x20,0x22,0x20,0x23,0xe0,0x20,0x00,0x2f,0xf0,0x24,0x10,0x42,0x20,0x41,0xc0,0x86,0x30,0x38,0x0e}},
	{0x6b63,0xe6ada3,0xD5FD,{0x00,0x00,0x7f,0xfc,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x11,0x00,0x11,0xf8,0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0xff,0xfe,0x00,0x00}},
	{0x5e38,0xe5b8b8,0xB3A3,{0x01,0x00,0x11,0x10,0x09,0x20,0x7f,0xfe,0x40,0x02,0x9f,0xf4,0x10,0x10,0x1f,0xf0,0x01,0x00,0x3f,0xf8,0x21,0x08,0x21,0x08,0x21,0x28,0x21,0x10,0x01,0x00,0x01,0x00}},
	{0x5f02,0xe5bc82,0xD2EC,{0x00,0x00,0x3f,0xf0,0x20,0x10,0x20,0x10,0x3f,0xf0,0x20,0x04,0x20,0x04,0x1f,0xfc,0x00,0x00,0x08,0x20,0x08,0x20,0xff,0xfe,0x08,0x20,0x10,0x20,0x20,0x20,0x40,0x20}},
	{0x7edc,0xe7bb9c,0xC2E7,{0x10,0x80,0x10,0x80,0x20,0xf8,0x21,0x08,0x4b,0x10,0xfc,0xa0,0x10,0x40,0x20,0xa0,0x41,0x18,0xfa,0x06,0x45,0xf8,0x01,0x08,0x19,0x08,0xe1,0x08,0x41,0xf8,0x01,0x08}},
	{0x6d3b,0xe6b4bb,0xBBEE,{0x00,0x10,0x20,0x78,0x13,0xc0,0x10,0x40,0x80,0x40,0x47,0xfe,0x40,0x40,0x10,0x40,0x10,0x40,0x23,0xf8,0xe2,0x08,0x22,0x08,0x22,0x08,0x22,0x08,0x23,0xf8,0x02,0x08}},
	{0x559c,0xe5969c,0xCFB2,{0x01,0x00,0x7f,0xfc,0x01,0x00,0x3f,0xf8,0x00,0x00,0x3f,0xf8,0x20,0x08,0x3f,0xf8,0x08,0x20,0xff,0xfe,0x00,0x00,0x3f,0xf8,0x20,0x08,0x20,0x08,0x3f,0xf8,0x20,0x08}},
	{0x5384,0xe58e84,0xB6F2,{0x00,0x00,0x3f,0xfe,0x20,0x00,0x20,0x00,0x27,0xf0,0x24,0x10,0x24,0x10,0x24,0x10,0x24,0x10,0x24,0x50,0x24,0x20,0x24,0x04,0x24,0x04,0x44,0x04,0x43,0xfc,0x80,0x00}},
	{0x8d1d,0xe8b49d,0xB1B4,{0x00,0x00,0x1f,0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x10,0x11,0x10,0x11,0x10,0x11,0x10,0x11,0x10,0x12,0x10,0x02,0x80,0x04,0x40,0x08,0x20,0x10,0x10,0x20,0x08}},
	{0x6c99,0xe6b299,0xC9B3,{0x00,0x40,0x20,0x40,0x10,0x40,0x11,0x48,0x81,0x44,0x42,0x42,0x42,0x42,0x14,0x48,0x10,0x48,0x20,0x48,0xe0,0x10,0x20,0x10,0x20,0x20,0x20,0x40,0x21,0x80,0x06,0x00}},
	{0x5766,0xe59da6,0xCCB9,{0x10,0x00,0x10,0x00,0x11,0xfc,0x11,0x04,0x11,0x04,0xfd,0x04,0x11,0xfc,0x11,0x04,0x11,0x04,0x11,0x04,0x11,0xfc,0x1d,0x04,0xe0,0x00,0x40,0x00,0x03,0xfe,0x00,0x00}},
	{0x7acb,0xe7ab8b,0xC1A2,{0x02,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x7f,0xfc,0x00,0x00,0x00,0x10,0x10,0x10,0x08,0x20,0x08,0x20,0x04,0x40,0x04,0x40,0x04,0x80,0x00,0x00,0xff,0xfe,0x00,0x00}},
	{0x666e,0xe699ae,0xC6D5,{0x08,0x20,0x04,0x40,0x7f,0xfc,0x04,0x40,0x24,0x48,0x14,0x50,0xff,0xfe,0x00,0x00,0x1f,0xf0,0x10,0x10,0x10,0x10,0x1f,0xf0,0x10,0x10,0x10,0x10,0x1f,0xf0,0x10,0x10}},
	{0x59a5,0xe5a6a5,0xCDD7,{0x00,0xfc,0x7f,0x00,0x02,0x08,0x21,0x08,0x11,0x10,0x10,0x20,0x02,0x00,0x02,0x00,0xff,0xfe,0x04,0x20,0x08,0x20,0x1e,0x40,0x01,0x80,0x06,0x60,0x18,0x18,0x60,0x04}},
	{0x62dc,0xe68b9c,0xB0DD,{0x04,0x00,0x1e,0xfc,0xf0,0x20,0x10,0x20,0x10,0xfc,0xfe,0x20,0x10,0x20,0x10,0xfc,0x10,0x20,0xfe,0x20,0x11,0xfe,0x10,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x80,0x20}},
	{0x7cd6,0xe7b396,0xCCC7,{0x10,0x20,0x10,0x10,0x95,0xfe,0x55,0x10,0x59,0x7c,0x11,0x14,0xfd,0xfe,0x31,0x14,0x39,0x7c,0x55,0x10,0x55,0x7c,0x91,0x44,0x11,0x44,0x12,0x44,0x12,0x7c,0x14,0x44}},
	{0x5e73,0xe5b9b3,0xC6BD,{0x00,0x00,0x7f,0xfc,0x01,0x00,0x01,0x00,0x11,0x10,0x09,0x10,0x09,0x20,0x01,0x00,0xff,0xfe,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00}},
	{0x667a,0xe699ba,0xD6C7,{0x20,0x00,0x3e,0x7c,0x48,0x44,0x08,0x44,0xff,0x44,0x14,0x44,0x22,0x7c,0x40,0x00,0x1f,0xf0,0x10,0x10,0x10,0x10,0x1f,0xf0,0x10,0x10,0x10,0x10,0x1f,0xf0,0x10,0x10}},
	{0x80fd,0xe883bd,0xC4DC,{0x10,0x40,0x24,0x44,0x42,0x48,0xff,0x70,0x01,0x40,0x00,0x42,0x7e,0x42,0x42,0x3e,0x42,0x00,0x7e,0x44,0x42,0x48,0x42,0x70,0x7e,0x40,0x42,0x42,0x4a,0x42,0x44,0x3e}},
	{0x836f,0xe88daf,0xD2A9,{0x04,0x40,0x04,0x40,0xff,0xfe,0x04,0x40,0x10,0x80,0x10,0x80,0x20,0xfc,0x45,0x04,0xfa,0x04,0x10,0x84,0x20,0x44,0xfc,0x44,0x00,0x04,0x1c,0x04,0xe0,0x28,0x40,0x10}},
	{0x54c1,0xe59381,0xC6B7,{0x00,0x00,0x1f,0xf0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0xf0,0x00,0x00,0x00,0x00,0x7c,0x7c,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7c,0x7c,0x44,0x44}},
	{0x8f85,0xe8be85,0xB8A8,{0x20,0x28,0x20,0x24,0x23,0xfe,0xfc,0x20,0x40,0x20,0x51,0xfc,0x91,0x24,0xfd,0x24,0x11,0xfc,0x11,0x24,0x1d,0x24,0xf1,0xfc,0x51,0x24,0x11,0x24,0x11,0x24,0x11,0x0c}},
	{0x52a9,0xe58aa9,0xD6FA,{0x00,0x20,0x7c,0x20,0x44,0x20,0x44,0x20,0x44,0xfc,0x7c,0x24,0x44,0x24,0x44,0x24,0x7c,0x24,0x44,0x24,0x44,0x24,0x44,0x44,0x4e,0x44,0xf0,0x84,0x01,0x28,0x02,0x10}},
	{0x7cfb,0xe7b3bb,0xCFB5,{0x00,0xf8,0x3f,0x00,0x04,0x00,0x08,0x20,0x10,0x40,0x3f,0x80,0x01,0x00,0x06,0x10,0x18,0x08,0x7f,0xfc,0x01,0x04,0x09,0x20,0x11,0x10,0x21,0x08,0x45,0x04,0x02,0x00}},
	{0x7edf,0xe7bb9f,0xCDB3,{0x10,0x40,0x10,0x20,0x20,0x20,0x23,0xfe,0x48,0x40,0xf8,0x88,0x11,0x04,0x23,0xfe,0x40,0x92,0xf8,0x90,0x40,0x90,0x00,0x90,0x19,0x12,0xe1,0x12,0x42,0x0e,0x04,0x00}},
	{0x5f00,0xe5bc80,0xBFAA,{0x00,0x00,0x7f,0xfc,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0xff,0xfe,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x10,0x20,0x10,0x20,0x20,0x20,0x40,0x20}},
	{0x59cb,0xe5a78b,0xCABC,{0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x40,0xfc,0x48,0x24,0x84,0x25,0xfe,0x24,0x82,0x24,0x00,0x48,0xfc,0x28,0x84,0x10,0x84,0x28,0x84,0x44,0x84,0x80,0xfc,0x00,0x84}},
	{0x5de5,0xe5b7a5,0xB9A4,{0x00,0x00,0x00,0x00,0x7f,0xfc,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0xff,0xfe,0x00,0x00,0x00,0x00}},
	{0x4f5c,0xe4bd9c,0xD7F7,{0x09,0x00,0x09,0x00,0x09,0x00,0x11,0xfe,0x12,0x80,0x32,0x80,0x34,0x80,0x50,0xf8,0x90,0x80,0x10,0x80,0x10,0x80,0x10,0xfc,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80}},
	{0x7237,0xe788b7,0xD2AF,{0x04,0x40,0x08,0x20,0x18,0x50,0x24,0x88,0x03,0x00,0x0c,0xc0,0x30,0x30,0xc0,0x0e,0x1f,0xf0,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x50,0x02,0x20,0x02,0x00,0x02,0x00}},
	{0x5976,0xe5a5b6,0xC4CC,{0x10,0x00,0x10,0x00,0x13,0xf8,0x10,0x88,0xfc,0x90,0x24,0x90,0x24,0xa0,0x24,0xbc,0x24,0x84,0x48,0x84,0x29,0x04,0x11,0x04,0x29,0x04,0x46,0x04,0x82,0x28,0x04,0x10}}
};
const String topics[5] = {"Cqfww8qWg","","","",""};
// 创建对象
DFRobot_DS0469      ds0469;
DFRobot_SYN6288     syn6288;
DFRobot_MLX90614    mlx90614;
DFRobot_SSD1306_I2C oled12864;
DFRobot_HuskyLens   huskylens;
DFRobot_Eeprom      eeprom;
DFRobot_Obloq       olq;


// 主程序开始
void setup() {
	Serial.begin(9600);
	oled12864.setChCode(chBuf);
	oled12864.begin(0x3c);
	DF_ChuShiHua();
}
void loop() {
	DF_NaoZhong();
	DF_RenLianShiBie();
	DF_YaoWuShiBie();
	DF_ZuoJianYaoWuXuanZe();
	DF_YouJianChuShiHuaYaoWuLiang();
}


// 自定义函数
void DF_beep(float mind_n_float) {
	for (int index = 0; index < mind_n_float; index++) {
		digitalWrite(4, HIGH);
		delay(100);
		digitalWrite(4, LOW);
		delay(100);
		yield();
	}
}
void DF_NaoZhong() {
	if (((ds0469.getTime(ds0469.HOUR)==8) && (ds0469.getTime(ds0469.MINUTE)==30))) {
		syn6288.playText("现在是早上服药时间,请爷爷奶奶按时服药", 2);
		delay(1000);
		digitalWrite(A5, HIGH);
		while (!syn6288.isIdle()) {yield();}
	}
	else {
		digitalWrite(A5, LOW);
	}
	if (((ds0469.getTime(ds0469.HOUR)==14) && (ds0469.getTime(ds0469.MINUTE)==30))) {
		syn6288.playText("现在是下午服药时间,请爷爷奶奶按时服药", 2);
		delay(1000);
		digitalWrite(A5, HIGH);
		while (!syn6288.isIdle()) {yield();}
	}
	else {
		digitalWrite(A5, LOW);
	}
}
void DF_CeLiangTiWen() {
	while (!(mind_n_TiWenCeLiangChengGong==1)) {
		mind_n_TiWen = (mlx90614.getObjectTempC() + 1);
		if ((mind_n_TiWen>34)) {
			DF_beep(1);
			oled12864.setCursorLine(2);
			oled12864.printLine((String((String("体温:") + String(mind_n_TiWen))) + String("度")));
			syn6288.playText((String((String("体温:") + String(mind_n_TiWen))) + String("度")), 0);
			while (!syn6288.isIdle()) {yield();}
			delay(1000);
			if ((mind_n_TiWen<37.3)) {
				DF_beep(1);
				oled12864.setCursorLine(3);
				oled12864.printLine("体温正常");
				syn6288.playText("体温正常", 0);
				while (!syn6288.isIdle()) {yield();}
				delay(1000);
				olq.publish(olq.topic_0, (String(mind_s_DangQianYongHu) + String((String((String((String("体温") + String(mind_n_TiWen))) + String("度"))) + String(",体温正常。")))));
			}
			else {
				DF_beep(3);
				oled12864.setCursorLine(3);
				oled12864.printLine("体温异常");
				syn6288.playText("体温异常", 0);
				while (!syn6288.isIdle()) {yield();}
				delay(1000);
				olq.publish(olq.topic_0, (String(mind_s_DangQianYongHu) + String((String((String((String("体温") + String(mind_n_TiWen))) + String("度"))) + String(",体温异常。")))));
			}
			mind_n_TiWenCeLiangChengGong = 1;
		}
		else {
			syn6288.playText("请把额头靠近测温器", 0);
			while (!syn6288.isIdle()) {yield();}
			delay(3000);
		}
		yield();
	}
	mind_n_TiWenCeLiangChengGong = 0;
	oled12864.setCursorLine(2);
	oled12864.printLine(" ");
	oled12864.setCursorLine(3);
	oled12864.printLine(" ");
	delay(2000);
}
void DF_YaoWuShiBie() {
	if ((huskylens.readBlockCenterParameterDirect().ID==6)) {
		delay(mind_n_debounce * 1000);
		huskylens.request();
		if ((huskylens.readBlockCenterParameterDirect().ID==6)) {
			DF_beep(1);
			oled12864.setCursor(0, 2);
			oled12864.print("络活喜");
			syn6288.playText("络活喜", 0);
			while (!syn6288.isIdle()) {yield();}
			mind_n_XuanYongYaoWu = 6;
			oled12864.setCursorLine(3);
			oled12864.printLine(" ");
		}
	}
	if ((huskylens.readBlockCenterParameterDirect().ID==7)) {
		delay(mind_n_debounce * 1000);
		huskylens.request();
		if ((huskylens.readBlockCenterParameterDirect().ID==7)) {
			DF_beep(1);
			oled12864.setCursor(0, 2);
			oled12864.print("厄贝沙坦");
			syn6288.playText("厄贝沙坦", 0);
			while (!syn6288.isIdle()) {yield();}
			mind_n_XuanYongYaoWu = 7;
			oled12864.setCursorLine(3);
			oled12864.printLine(" ");
		}
	}
	if ((huskylens.readBlockCenterParameterDirect().ID==8)) {
		delay(mind_n_debounce * 1000);
		huskylens.request();
		if ((huskylens.readBlockCenterParameterDirect().ID==8)) {
			DF_beep(1);
			oled12864.setCursor(0, 2);
			oled12864.print("立普妥");
			syn6288.playText("立普妥", 0);
			while (!syn6288.isIdle()) {yield();}
			mind_n_XuanYongYaoWu = 8;
			oled12864.setCursorLine(3);
			oled12864.printLine(" ");
		}
	}
	if ((huskylens.readBlockCenterParameterDirect().ID==9)) {
		delay(mind_n_debounce * 1000);
		huskylens.request();
		if ((huskylens.readBlockCenterParameterDirect().ID==9)) {
			DF_beep(1);
			oled12864.setCursor(0, 2);
			oled12864.print("拜糖平");
			syn6288.playText("拜糖平", 0);
			while (!syn6288.isIdle()) {yield();}
			mind_n_XuanYongYaoWu = 9;
			oled12864.setCursorLine(3);
			oled12864.printLine(" ");
		}
	}
}
void DF_YouJianChuShiHuaYaoWuLiang() {
	if ((digitalRead(A0)==1)) {
		DF_beep(1);
		mind_n_BanLanGenKeLiShiYongShuLiang = 0;
		mind_n_GanMaoLingKeLiShiYongShuLiang = 0;
		mind_n_PuDiLanKouFuYeShiYongShuLiang = 0;
		mind_n_XiaoErNaMinKeLiShiYongShuLiang = 0;
		eeprom.write(1,0);
		eeprom.write(2,0);
		eeprom.write(3,0);
		eeprom.write(4,0);
		syn6288.playText("新的一周开始了,请记得按时服药。", 0);
		while (!syn6288.isIdle()) {yield();}
		olq.publish(olq.topic_0, (String((String("络活喜 本周恢复为 ") + String((String(mind_n_BanLanGenKeLiShiYongShuLiang).toInt())))) + String("份。")));
		olq.publish(olq.topic_0, (String((String("厄贝沙坦 本周恢复为 ") + String((String(mind_n_GanMaoLingKeLiShiYongShuLiang).toInt())))) + String("份。")));
		olq.publish(olq.topic_0, (String((String("立普妥 本周恢复为 ") + String((String(mind_n_PuDiLanKouFuYeShiYongShuLiang).toInt())))) + String("份。")));
		olq.publish(olq.topic_0, (String((String("拜糖平 本周恢复为 ") + String((String(mind_n_XiaoErNaMinKeLiShiYongShuLiang).toInt())))) + String("份。")));
		DF_beep(1);
		delay(1000);
	}
}
void DF_ChuShiHua() {
	DF_beep(1);
	mind_n_debounce = 0.5;
	mind_n_TiWenCeLiangChengGong = 0;
	mind_n_XuanYongYaoWu = 0;
	mind_n_BanLanGenKeLiShiYongShuLiang = eeprom.read(1);
	mind_n_GanMaoLingKeLiShiYongShuLiang = eeprom.read(2);
	mind_n_PuDiLanKouFuYeShiYongShuLiang = eeprom.read(3);
	mind_n_XiaoErNaMinKeLiShiYongShuLiang = eeprom.read(4);
	mind_s_Version = "V20201128";
	Serial.println(mind_s_Version);
	oled12864.fillScreen(0);
	oled12864.setCursor(0, 0);
	oled12864.print("智能药品辅助系统");
	oled12864.setCursorLine(4);
	oled12864.printLine(mind_s_Version);
	DF_beep(1);
	huskylens.beginSoftwareSerialUntilSuccess(52, 53);
	DF_beep(1);
	olq.startConnect(17, 16, "HP03O846I25MSE5558", "877Wa811", "rkZAlcgy1X", "SyzAe9xyyQ", topics, "iot.dfrobot.com.cn", 1883);
	olq.publish(olq.topic_0, "智能服药小帮手");
	olq.publish(olq.topic_0, (String((String("络活喜本周已服用") + String((String(mind_n_BanLanGenKeLiShiYongShuLiang).toInt())))) + String("份。")));
	olq.publish(olq.topic_0, (String((String("厄贝沙坦本周已服用") + String((String(mind_n_GanMaoLingKeLiShiYongShuLiang).toInt())))) + String("份。")));
	olq.publish(olq.topic_0, (String((String("立普妥本周已服用") + String((String(mind_n_PuDiLanKouFuYeShiYongShuLiang).toInt())))) + String("份。")));
	olq.publish(olq.topic_0, (String((String("拜糖平 本周已服用 ") + String((String(mind_n_XiaoErNaMinKeLiShiYongShuLiang).toInt())))) + String("份。")));
	DF_beep(1);
	syn6288.begin(&Serial3, 15, 14, 3);
	syn6288.setVolume(true, 10);
	syn6288.playText("智能服药小帮手,开始工作。", 0);
	while (!syn6288.isIdle()) {yield();}
	oled12864.setCursorLine(4);
	oled12864.printLine("开始工作...");
	DF_beep(1);
	ds0469.begin();
	ds0469.setTime(constrain(2021, 2000, 2099), constrain(5, 1, 12), constrain(23, 1, 31), constrain(16, 0, 23), constrain(20, 0, 59), constrain(0, 0, 59));
	Serial.println("hello");
}
void DF_RenLianShiBie() {
	huskylens.request();
	if ((huskylens.readBlockCenterParameterDirect().ID==2)) {
		delay(mind_n_debounce * 1000);
		huskylens.request();
		if ((huskylens.readBlockCenterParameterDirect().ID==2)) {
			mind_s_DangQianYongHu = "爷爷";
			DF_beep(1);
			oled12864.setCursor(16, 2);
			oled12864.print("爷爷");
			syn6288.playText("爷爷", 0);
			while (!syn6288.isIdle()) {yield();}
			syn6288.playText("服用两种药", 0);
			while (!syn6288.isIdle()) {yield();}
			syn6288.playText("早饭后服用络活喜", 0);
			while (!syn6288.isIdle()) {yield();}
			syn6288.playText("午饭后服用厄贝沙坦", 0);
			while (!syn6288.isIdle()) {yield();}
			oled12864.setCursorLine(3);
			oled12864.printLine(" ");
			delay(1000);
			DF_CeLiangTiWen();
		}
	}
	if ((huskylens.readBlockCenterParameterDirect().ID==3)) {
		delay(mind_n_debounce * 1000);
		huskylens.request();
		if ((huskylens.readBlockCenterParameterDirect().ID==3)) {
			mind_s_DangQianYongHu = "奶奶";
			DF_beep(1);
			oled12864.setCursor(16, 2);
			oled12864.print("奶奶");
			syn6288.playText("奶奶", 0);
			while (!syn6288.isIdle()) {yield();}
			syn6288.playText("服用两种药", 0);
			while (!syn6288.isIdle()) {yield();}
			syn6288.playText("晚饭后服用立普妥", 0);
			while (!syn6288.isIdle()) {yield();}
			syn6288.playText("睡前服用拜糖平", 0);
			while (!syn6288.isIdle()) {yield();}
			oled12864.setCursorLine(3);
			oled12864.printLine(" ");
			delay(1000);
			DF_CeLiangTiWen();
		}
	}
}
void DF_ZuoJianYaoWuXuanZe() {
	if ((digitalRead(A2)==1)) {
		DF_beep(1);
		if ((mind_n_XuanYongYaoWu==6)) {
			mind_n_BanLanGenKeLiShiYongShuLiang += 1;
			eeprom.write(1,mind_n_BanLanGenKeLiShiYongShuLiang);
			olq.publish(olq.topic_0, (String((String("络活喜 本周已服用 ") + String((String(mind_n_BanLanGenKeLiShiYongShuLiang).toInt())))) + String("份。")));
			syn6288.playText((String((String("络活喜  本周已服用 ") + String((String(mind_n_BanLanGenKeLiShiYongShuLiang).toInt())))) + String("份。")), 0);
			while (!syn6288.isIdle()) {yield();}
		}
		if ((mind_n_XuanYongYaoWu==7)) {
			mind_n_GanMaoLingKeLiShiYongShuLiang += 1;
			eeprom.write(2,mind_n_GanMaoLingKeLiShiYongShuLiang);
			olq.publish(olq.topic_0, (String((String("厄贝沙坦 本周已服用 ") + String((String(mind_n_GanMaoLingKeLiShiYongShuLiang).toInt())))) + String("份。")));
			syn6288.playText((String((String("厄贝沙坦 本周已服用 ") + String((String(mind_n_GanMaoLingKeLiShiYongShuLiang).toInt())))) + String("份。")), 0);
			while (!syn6288.isIdle()) {yield();}
		}
		if ((mind_n_XuanYongYaoWu==8)) {
			mind_n_PuDiLanKouFuYeShiYongShuLiang += 1;
			eeprom.write(3,mind_n_BanLanGenKeLiShiYongShuLiang);
			olq.publish(olq.topic_0, (String((String("立普妥 本周已服用 ") + String((String(mind_n_PuDiLanKouFuYeShiYongShuLiang).toInt())))) + String("份。")));
			syn6288.playText((String((String("立普妥 本周已服用 ") + String((String(mind_n_PuDiLanKouFuYeShiYongShuLiang).toInt())))) + String("份。")), 0);
			while (!syn6288.isIdle()) {yield();}
		}
		if ((mind_n_XuanYongYaoWu==9)) {
			mind_n_XiaoErNaMinKeLiShiYongShuLiang += 1;
			eeprom.write(4,mind_n_XiaoErNaMinKeLiShiYongShuLiang);
			olq.publish(olq.topic_0, (String((String("拜糖平本周已服用 ") + String((String(mind_n_XiaoErNaMinKeLiShiYongShuLiang).toInt())))) + String("份。")));
			syn6288.playText((String((String("拜糖平 本周已服用 ") + String((String(mind_n_XiaoErNaMinKeLiShiYongShuLiang).toInt())))) + String("份。")), 0);
			while (!syn6288.isIdle()) {yield();}
		}
		delay(1000);
	}
}
projectImage
附件
icon 胡家颖+夏炜琦+AI智能服药小帮手.zip 503KB
下载
队伍名称 七雅女孩队 参赛组别 小学
参赛学生 胡家颖 广州市越秀区东山培正小学 夏炜琦 雅荷塘小学
指导老师
张水军 广州市越秀区东山培正小学