资源简介
这个智能家居控制系统,是本人亲身体会的第一个嵌入式项目,在开发过程中遇到了许多的技术难题,均已一一解决。本智能家居系统主要监控视频,温度,红外,自动发短消息,自动报警等功能。

代码片段和文件信息
#include
#include
#include
#include
#include
#include “linux/input.h“
#include “log.h“
#include “device.h“
#include “msg.h“
/* 功能:打开设备
* 返回值:-1:失败; 0:成功
* 参数:无
* */
int init_device(void)
{
int arg = 12;
regeditorfd = open(REGEDITOR_DEV O_RDWR);
if(regeditorfd < 0) {
ERROR(“open regeditor device error\n“);
return -1;
}
ledfd = open(LED_DEV O_RDWR);
if(ledfd < 0) {
ERROR(“open led device error\n“);
return -1;
}
beepfd = open(BEEP_DEV O_RDWR);
if (beepfd < 0) {
ERROR(“open beep device error\n“);
return -1;
}
tempfd = open(TEMP_DEV O_RDWR);
if (tempfd < 0) {
ERROR(“open temperature device error\n“);
return -1;
}
adcfd = open(ADC_DEV O_RDWR);
if (adcfd < 0) {
ERROR(“open adc device error\n“);
return -1;
}
buttonfd = open(BUTTON_DEV O_RDWR);
if (buttonfd < 0) {
ERROR(“open button device error\n“);
return -1;
}
eepromfd = open(EEPROM_DEV O_RDWR);
if (eepromfd < 0) {
ERROR(“open eeprom device error\n“);
return -1;
}
#if 0
lcdfd = open(LCD_DEV O_RDWR);
if (lcdfd < 0) {
ERROR(“open lcd device error\n“);
return -1;
}
gprsfd = open(GPRS_DEV O_RDWR);
if (gprsfd < 0) {
ERROR(“open gprs device error\n“);
return -1;
}
zigbeefd = open(ZIGBEE_DEV O_RDWR);
if (zigbeefd < 0) {
ERROR(“open zigbee device error\n“);
return -1;
}
if (init_uart(gprsfd B115200) == -1) {
ERROR(“init uart for gprs error\n“);
return -1;
}
if (init_uart(zigbeefd B115200) == -1) {
ERROR(“init uart for zigbee error\n“);
return -1;
}
if (gprs_config() == -1) {
ERROR(“config gprs center error\n“);
return -1;
}
#endif
/* 配置温度传感器*/
ioctl(tempfd IOCTL_DS18B20_S_BIT &arg);
/* 配置ADC*/
adc_config(10 1);
return 0;
}
/* 功能:初始化串口
* 返回值:0:成功;1:失败
* 参数fd:串口文件描述符,即那个串口
* 参数speed:波特率
* */
int init_uart(int fd int speed)
{
struct termios options;
bzero(&options sizeof(options));
cfsetispeed(&options speed);
cfsetospeed(&options speed);
options.c_cflag |= (CS8 | CREAD);
options.c_iflag |= IGNPAR;
tcflush(fd TCIFLUSH);
tcsetattr(fd TCSANOW &options);
return 0;
}
/* 功能:配置GPRS短信服务中心
* 返回值:1:失败;0:成功
* 参数:无
* */
int gprs_config(void)
{
char *cmd[] = {“AT+CMFG=1\r“
“AT+CSCA=\“+8613800100500\“\r“};
int i;
for (i = 0; i < sizeof(cmd) / sizeof
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-03-08 20:14 gprs_security\
目录 0 2013-03-08 20:14 gprs_security\.git\
目录 0 2013-03-08 20:14 gprs_security\.git\branches\
文件 265 2012-10-29 09:42 gprs_security\.git\config
文件 73 2012-10-29 09:42 gprs_security\.git\desc
文件 23 2012-10-29 09:42 gprs_security\.git\HEAD
目录 0 2013-03-08 20:14 gprs_security\.git\hooks\
文件 452 2012-10-29 09:42 gprs_security\.git\hooks\applypatch-msg.sample
文件 896 2012-10-29 09:42 gprs_security\.git\hooks\commit-msg.sample
文件 189 2012-10-29 09:42 gprs_security\.git\hooks\post-update.sample
文件 398 2012-10-29 09:42 gprs_security\.git\hooks\pre-applypatch.sample
文件 1704 2012-10-29 09:42 gprs_security\.git\hooks\pre-commit.sample
文件 4898 2012-10-29 09:42 gprs_security\.git\hooks\pre-reba
文件 1239 2012-10-29 09:42 gprs_security\.git\hooks\prepare-commit-msg.sample
文件 3611 2012-10-29 09:42 gprs_security\.git\hooks\update.sample
文件 1896 2012-10-29 09:42 gprs_security\.git\index
目录 0 2013-03-08 20:14 gprs_security\.git\info\
文件 240 2012-10-29 09:42 gprs_security\.git\info\exclude
目录 0 2013-03-08 20:14 gprs_security\.git\logs\
文件 196 2012-10-29 09:42 gprs_security\.git\logs\HEAD
目录 0 2013-03-08 20:14 gprs_security\.git\logs\refs\
目录 0 2013-03-08 20:14 gprs_security\.git\logs\refs\heads\
文件 196 2012-10-29 09:42 gprs_security\.git\logs\refs\heads\master
目录 0 2013-03-08 20:14 gprs_security\.git\ob
目录 0 2013-03-08 20:14 gprs_security\.git\ob
目录 0 2013-03-08 20:14 gprs_security\.git\ob
文件 4852 2012-10-29 09:42 gprs_security\.git\ob
文件 128988 2012-10-29 09:42 gprs_security\.git\ob
文件 94 2012-10-29 09:42 gprs_security\.git\packed-refs
目录 0 2013-03-08 20:14 gprs_security\.git\refs\
目录 0 2013-03-08 20:14 gprs_security\.git\refs\heads\
............此处省略110个文件信息
- 上一篇:D3 地图可视化数据美国地图
- 下一篇:数学形态学方法及应用-崔屹
相关资源
- DV泵加罗茨泵独立控制系统PID.smart
- 六路智能抢答器VHDL语言
- 推箱子及人工智能寻路C 源代码
- 单片机 DS18B20 温度控制系统
- 智能寻迹机器人源程序及pcb图
- 课程设计蔬菜大棚自动控制系统,包
- 北航人工智能原理课大作业源代码,
- 带时间温度显示的室内灯光控制系统
- ISO7816 协议标准
- 基于51单片机的智能温控器
- 多线程实例:桌面智能弹球小游戏
- 基于电能信息终端的智能家居系统
- 国网《500千伏及以上变电站 远程智能
- labview智能电梯(6层电梯.vi)
- 易语言:电脑智能屏幕锁
- 一种智能大功率直流电源的设计与实
- 智能路由器怎么了?为何退潮
- 智能光网络ASON的关键技术及发展策略
- 消防指示灯智能监控系统三端口网关
- 在各城市的窄带物联网中传感器起到
- 物联网家居系统中基于单片机的多路
- 盘点主流智能家居硬件常见的六大问
- 基于PIC的TCP/IP网络协议和zigbee无线传
- 传感器应用领域的扩大发展强劲
- 基于STM32的深海钻机甲板控制系统
- oppo智能手机adb驱动程序
- 串行通信在多路温度智能仪表中的应
- 基于进化算法的岩体参数智能识别
- 智能卡PCSC读卡器指令发送工具
- 采用NFC技术的无线遥控器系统电路设
评论
共有 条评论