温湿度 检测 能够显示 i2c12864
详情https://g.alicdn.com/idleFish-F2e/app-basic/item.html?itemid=573263642630&ut_sk=1.WxEIBJ%252FiSUoDADyw2O%252FQUZqV_21407387_1538638809582.Copy.detail.573263642630.1977947810&forceFlush=1

一下代码部分
double Fahrenheit(double celsius)
{
return 1.8 * celsius + 32;
} //摄氏温度度转化为华氏温度

double Kelvin(double celsius)
{
return celsius + 273.15;
} //摄氏温度转化为开氏温度

// 露点(点在此温度时,空气饱和并产生露珠)
// 参考: [url=http://wahiduddin.net/calc/density_algorithms.htm]http://wahiduddin.net/calc/density_algorithms.htm[/url]
double dewPoint(double celsius, double humidity)
{
double A0= 373.15/(273.15 + celsius);
double SUM = -7.90298 * (A0-1);
SUM += 5.02808 * log10(A0);
SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
SUM += log10(1013.246);
double VP = pow(10, SUM-3) * humidity;
double T = log(VP/0.61078); // temp var
return (241.88 * T) / (17.558-T);
}

// 快速计算露点,速度是5倍dewPoint()
// 参考: [url=http://en.wikipedia.org/wiki/Dew_point]http://en.wikipedia.org/wiki/Dew_point[/url]
double dewPointFast(double celsius, double humidity)
{
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity/100);
double Td = (b * temp) / (a - temp);
return Td;
}
#include <LiquidCrystal.h>
#include <RSCG12864B.h>
#include <RFID.h>
#include <SPI.h>
#include <Servo.h>
#include <IRremote.h>
#include <dht11.h>
dht11 DHT11;

#define DHT11PIN 2
Servo myservo;
int PIN_SENSOR = 4;
int d=5;
int m=(float)DHT11.temperature;
int RECV_PIN = 3;//红外接收输入

decode_results results;
IRrecv irrecv(RECV_PIN);
extern uint8_t SmallFont[];
RFID rfid(10,8); //D10–接上SDA、D8–接RST D13–接上SCK D11–接上MOSI D12–接上MISO RQ不接
unsigned char serNum[5];

void setup()
{
int chk = DHT11.read(DHT11PIN);
unsigned char j;
char chn[]={0xBB, 0xB6,0xD3, 0xAD,0xBB, 0xD8,0xC0, 0xB4 }; //欢迎回来

char f1[]={ 0xBF, 0xAA,0xC3, 0xC5,0xD6, 0xD0,0, }; //开门中
char f2[]={ 0xC7, 0xEB,0xC7, 0xC3, 0xC3, 0xC5,0,}; //请敲门
char f3[]={ 0xBE, 0xDC, 0xBE, 0xF8,0xB9, 0xE3,0xB8, 0xE6,0,}; //拒绝广告
char f4[]={0xCA, 0xD2,0xC4, 0xDA,0xCE, 0xC2,0xB6, 0xC8,0, }; //shinei温度
char f5[]={ 0xCA, 0xAA,0xB6, 0xC8 ,0,}; //湿度
char f6[]={ 0xC7, 0xEB, 0xCB, 0xA2, 0xBF, 0xA8,0, }; //请刷卡
char f7[]={ 0xA1, 0xE6,0, }; //℃
Serial.begin(9600);
Serial.begin(9600);//串口用来读取需要添加的卡号,然后手动写到程序里
RSCG12864B.begin();//串口初始化
RSCG12864B.brightness(255);//屏幕亮度
myservo.attach(9);//舵机针脚位9
myservo.write(0); //舵机初始化0度
SPI.begin();
rfid.init();
irrecv.enableIRIn(); // Start the receiver
pinMode(d,OUTPUT);
digitalWrite(d,HIGH);
pinMode(PIN_SENSOR, INPUT);

RSCG12864B.clear();
RSCG12864B.print_string_16_xy(30,0,f3);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(37,15,f2);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(37,30,f6);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(5,45,f4);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(103,45,f7);//坐标0,15,显示chn里的内容

RSCG12864B.font_revers_on();char text[5];

{
dtostrf(DHT11.temperature,5,2,text);//dtostrf函数很好用,可以将字符变成字符串显示。
RSCG12864B.print_string_12_xy(70,47,text);//定义字符串坐标。
}

  delay(1000);

}

void loop()
{
int chk = DHT11.read(DHT11PIN);

unsigned charj;
char chn[]={0xBB, 0xB6,0xD3, 0xAD,0xBB, 0xD8,0xC0, 0xB4 ,0, }; //欢迎回来

char f1[]={ 0xBF, 0xAA,0xC3, 0xC5,0xD6, 0xD0 ,0, }; //开门中
char f2[]={ 0xC7, 0xEB,0xC7, 0xC3, 0xC3, 0xC5,0,}; //请敲门
char f3[]={ 0xBE, 0xDC, 0xBE, 0xF8,0xB9, 0xE3,0xB8, 0xE6,0,}; //拒绝广告
char f4[]={0xCA, 0xD2,0xC4, 0xDA,0xCE, 0xC2,0xB6, 0xC8,0, }; //shinei温度
char f5[]={ 0xCA, 0xAA,0xB6, 0xC8,0, }; //湿度
char f6[]={ 0xC7, 0xEB, 0xCB, 0xA2, 0xBF, 0xA8,0, }; //请刷卡
char f7[]={ 0xA1, 0xE6,0, }; //℃
char f8[]={ 0xC7, 0xEB,0xC1, 0xBD,0xC3, 0xEB, 0xC4, 0xDA, 0xCD, 0xC6,0xC3, 0xC5,0xBD, 0xF8 ,0, }; //请两秒内推门进
char f9[]={ 0xB3, 0xF4,
0xBF, 0xA8,
0xC4, 0xC3,
0xBF, 0xAA,
0xA3, 0xAC,
0xB2, 0xBB,
0xC8, 0xC3,
0xBD, 0xF8,0, }; //把你的臭卡拿开
digitalWrite(5,HIGH);

if (irrecv.decode(&results))

{
if (results.value == results.value)
{
Serial.println(results.value, HEX);
Serial.println(“2”);
myservo.write(180);
digitalWrite(6,HIGH);
RSCG12864B.clear();
RSCG12864B.print_string_16_xy(0,0,f8);//坐标0,15,显示chn里的内容
delay(3500);
RSCG12864B.clear();
RSCG12864B.print_string_16_xy(30,0,f3);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(37,15,f2);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(37,30,f6);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(5,45,f4);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(103,45,f7);//坐标0,15,显示chn里的内容
char text[5];
{
dtostrf(DHT11.temperature,5,2,text);//dtostrf函数很好用,可以将字符变成字符串显示。
RSCG12864B.print_string_12_xy(70,47,text);//定义字符串坐标。
}
digitalWrite(6,LOW);
myservo.write(0);
irrecv.resume();
}
delay(100);
irrecv.resume();

}/*
int x = digitalRead(PIN_SENSOR);
Serial.println(x);
if (x==0)
{ myservo.write(180);
digitalWrite(6,HIGH);
delay(3500);
digitalWrite(6,LOW);
myservo.write(0);
}*/
long randNumber = random(0, 20);
unsigned char i,tmp;
unsigned char status;
unsigned char str[MAX_LEN];
unsigned char RC_size;

//找卡
rfid.isCard();
//读卡号
if (rfid.readCardSerial())
{
Serial.print("your card id is : “);
Serial.print(rfid.serNum[0]);
Serial.print(” , “);
Serial.print(rfid.serNum[1],BIN);
Serial.print(” , “);
Serial.print(rfid.serNum[2],BIN);
Serial.print(” , “);
Serial.print(rfid.serNum[2],BIN);
Serial.print(” , “);
Serial.print(rfid.serNum[4],BIN);
Serial.println(” ");

//下面是改卡号区域
if(rfid.serNum[0]==1||rfid.serNum[0]==19||rfid.serNum[0]==195||rfid.serNum[0]==147||rfid.serNum[0]==99||rfid.serNum[0]==67||rfid.serNum[0]==179||rfid.serNum[0]==225){//第一道筛选

  {if(rfid.serNum[1]==2||rfid.serNum[1]==235||rfid.serNum[1]==152||rfid.serNum[1]==141||rfid.serNum[1]==12||rfid.serNum[1]==164||rfid.serNum[1]==113||rfid.serNum[1]==100)//第二道筛选,支持一人一号{if(rfid.serNum[2]==3||rfid.serNum[2]==139||rfid.serNum[2]==30||rfid.serNum[2]==29||rfid.serNum[2]==31||rfid.serNum[2]==109){if(rfid.serNum[3]==3||rfid.serNum[3]==60||rfid.serNum[3]==63||rfid.serNum[3]==109)Serial.println("Welcome test 1"); for(int i=0;i<100;i++ )myservo.write(180);digitalWrite(6,HIGH);  }if(rfid.serNum[0]==1||rfid.serNum[0]==19||rfid.serNum[0]==195||rfid.serNum[0]==147||rfid.serNum[0]==99||rfid.serNum[0]==67||rfid.serNum[0]==179||rfid.serNum[0]==225&&rfid.serNum[1]==2||rfid.serNum[1]==235||rfid.serNum[1]==100||rfid.serNum[1]==152||rfid.serNum[1]==141||rfid.serNum[1]==12||rfid.serNum[1]==164||rfid.serNum[1]==113&&rfid.serNum[2]==3||rfid.serNum[2]==139||rfid.serNum[2]==30||rfid.serNum[2]==29||rfid.serNum[2]==109||rfid.serNum[2]==31&&rfid.serNum[3]==3||rfid.serNum[3]==60||rfid.serNum[3]==109||rfid.serNum[3]==63){Serial.println(DHT11.temperature);myservo.write(180); digitalWrite(6,HIGH); RSCG12864B.clear();
RSCG12864B.print_string_16_xy(15,15,chn);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(15,30,f1);//坐标0,15,显示chn里的内容delay(2500);myservo.write(0);digitalWrite(6,LOW);Serial.println("closed1");}}       else{myservo.write(0);digitalWrite(6,LOW);Serial.println("closed");RSCG12864B.clear();RSCG12864B.print_string_16_xy(0,0,f9);//坐标0,15,显示chn里的内容

delay(2500);
}
irrecv.resume();
RSCG12864B.clear();
RSCG12864B.print_string_16_xy(30,0,f3);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(37,15,f2);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(37,30,f6);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(5,45,f4);//坐标0,15,显示chn里的内容
RSCG12864B.print_string_16_xy(103,45,f7);//坐标0,15,显示chn里的内容

RSCG12864B.font_revers_on();char text[5];

{
dtostrf(DHT11.temperature,5,2,text);//dtostrf函数很好用,可以将字符变成字符串显示。
RSCG12864B.print_string_12_xy(70,47,text);//定义字符串坐标。
}

  }
}

}

if (!rfid.readCardSerial())
rfid.halt(); //休眠
}

arduino舵机门锁 红外遥控控制 刷卡 diy相关推荐

  1. Arduino VS/HX1838红外遥控接收和发送DEMO

    Arduino VS/HX1838红外遥控接收和发送DEMO

  2. arduino红外遥控控制LED灯亮度

    红外接收和红外发射 vcc接5v或者3.3v 红外接收头的接线 IRremote库安装 如果下面运行版本报错请下载第一点的版本比如2.x.x 获取遥控器按键的值 /* 红外遥控,通过串口查看每个按钮对 ...

  3. Arduino 入门篇 —— 红外遥控传感

    一.硬件 VCC对应5V ,OUT则对应一个数字引脚 二.代码 1.初试红外遥控 功能:通过串口查看红外遥控器按钮对应的红外码,代码如下: /* 红外遥控,通过串口查看每个按钮对应的红外码, 同时每按 ...

  4. arduino红外遥控控制小灯

    #include <IRremote.h> //包含头文件 const int PIN = 11;//接红外接口 const int LED =13;//接灯 IRrecv HW(PIN) ...

  5. Arduino宿舍门禁,实现刷卡(NFC)开门

    起因 最近在学习智能车程序,突然对开发产生了极大的兴趣,一个合格的懒人就要自己做一个刷手机开门.再也不用带沉重的钥匙了,也不需要为忘记带钥匙的室友开门了.选择Arduino是因为它简单,不需要配置寄存 ...

  6. 105、基于51单片机的智能电子密码锁红外遥控控制系统设计

    毕设帮助.开题指导.技术解答(有偿)见文末. 目录 摘要 一.硬件方案 二.设计功能 三.实物图 四.原理图 五.PCB图 六.Protues仿真 七.程序源码 八.资料包括 摘要 在日常的生活和工作 ...

  7. 51单片机 驱动步进电机 C语言 lcd,51单片机红外遥控控制步进电机的LCD显示源程序...

    /******************************************************************************* * 实验名              ...

  8. 基于STM32的智能家居控制系统设计与实现(带红外遥控控制空调)

    1. 前言 智能家居作为家庭信息化的实现方式,已经成为社会信息化发展的重要组成部分,物联网因其巨大的应用前景,将是智能家居产业发展过程中一个比较现实的突破口,对智能家居的产业发展具有重大意义. 本文基 ...

  9. 关于以Arduino为主板,利用红外遥控器控制42步进电机同步带滑台移动

    Arduino控制步进电机 Arduino控制滑台 Arduino红外遥控 红外遥控步进电机 红外遥控滑台 本案例使用物品 Arduino Mega 1838红外一体接受器 红外遥控器 200mm同步 ...

最新文章

  1. RandomStringUtils工具类
  2. 清除messages
  3. python function terminated_calibre 打不开也转不了 并且出现错误 mobi转docx
  4. PDF.js如何添加放大缩小的功能,转换成图片应该如何实现?
  5. SecureCRT 全屏切换
  6. Web压力测试工具 - Siege
  7. EmEditor Pro 8.3简体中文绿色增强(无需安装)版
  8. 开机后系统时间被恶意修改
  9. 推荐一个免费绘制软件架构图的网站
  10. 最好用的十六进制编辑器010 Editor
  11. IDEA创建JSP项目
  12. 如何修改云服务器连接密码错误,如何修改云服务器连接密码
  13. FastReport报表控件使用技巧总结
  14. C++扑克牌随机洗牌抽牌算法
  15. android开发软件!Android免打包多渠道统计如何实现?满满干货指导
  16. 量化:常见策略指标合集
  17. c++ union学习
  18. devexpress表格控件gridcontrol设置隔行变色、焦点行颜色、设置(改变)显示值、固定列不移动(附源码)...
  19. 大众点评坐标抓取php,如何抓取(采集)大众点评网的坐标(经纬度)信息
  20. python编程锦囊pdf百度云_python编程锦囊 相关实例(示例源码)下载 - 好例子网

热门文章

  1. UE4-网格物件,比如窗户屏风栅格,出现频闪的解决
  2. 基于SSM+Vue的电影售票系统Java电影院票务管理系统电影订票系统(源码调试+讲解+文档)
  3. Solidity语法规范整理
  4. Jexus 安装配置,官网说明
  5. 变量定义需放在当前代码的最前面,吃亏了出bugg了
  6. 【私人订制Python模块库】Pyemail:更方便快捷地发送电子邮件
  7. Colly 学习笔记(二)——爬虫框架,抓取下载数据(上证A股数据下载)
  8. golang快速入门--爬虫--基于colly框架的爬虫案例
  9. Discuz!教程之大型Discuz!论坛站点帖子表forum_post分表方案优化
  10. [18] Window PowerShell DSC学习系列---- 如何区分WMF4.0和WMF 5.0?