久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標(biāo)題:
利用ESP8266實(shí)現(xiàn)的雙電子設(shè)備通信實(shí)驗(yàn)程序
[打印本頁]
作者:
Sicinera
時(shí)間:
2019-8-12 11:14
標(biāo)題:
利用ESP8266實(shí)現(xiàn)的雙電子設(shè)備通信實(shí)驗(yàn)程序
功能并不復(fù)雜,會(huì)用ESP8266便能想到思路;
但是在實(shí)現(xiàn)wifi模塊接受設(shè)備一的消息后將消息處理后發(fā)送給設(shè)備二的功能時(shí),還是頗費(fèi)腦筋的;
最后一提,當(dāng)時(shí)找不到現(xiàn)成歷程,oled字模便自己取了,這么一說沒有功勞也有苦勞了哈。
以下是部分程序:
#include <reg52.h>
#include <stdio.h>
#include <string.h>
#include <intrins.h>
#define U unsigned char
sbit scl=P1^1;
sbit sda=P1^0;
sbit key1=P1^6;
sbit key2=P1^7;
U a[81]={1},st=1,sq=1;
char page=0;
U num=0,sw=1; //"Enter" controlling
U code order1[]="AT+RST\r\n";
U code order2[]="AT+CWMODE=2\r\n";
U code order3[]="AT+CWSAP=\"sPinAr\",\"22222222\",11,3\r\n";
U code order4[]="AT+CIPMUX=1\r\n";
U code order5[]="AT+CIPSERVER=1,808
void time(){
U i,j;
for(i=200;i>0;i--)
for(j=200;j>0;j--);
}
U scan(){
U i;
if(!key1){
time();while(!key1);
return 2;
}
if(!key2){
time();while(!key2);
return 2;
}
if(sw&&num>=2){
for(i=1;i<81;i++)a[i]=0;
sw=0;
return 3;
}
return 0;
}
void wificommand(U k[]){
U i,j;
ES=0;
TI=1;
puts(k);
while(!TI);
TI=0;
ES=1;
while(1){
if(a[1]){
OLED_SetPos(0,page);
for(i=1;i<81;i++){
if(a[i]>='0'&&a[i]<='9')
for(j=0;j<6;j++)dat(digital[a[i]-48][j]);
else if(a[i]=='.')
for(j=0;j<6;j++)dat(dt_pls[0][j]);
else if(a[i]>='A'&&a[i]<='Z')
for(j=0;j<6;j++)dat(alpha[a[i]-65][j]);
else if(a[i]>='a'&&a[i]<='z')
for(j=0;j<6;j++)dat(bet[a[i]-97][j]);
else if(a[i]=='+')
for(j=0;j<6;j++)dat(dt_pls[1][j]);
else dat(0x00);
}
}
if(scan()==2){
for(i=1;i<81;i++)a[i]=0;
break;
}
}
page=4*!page;
}
void doublechat(){
U i,j,l;
while(1){
if(a[3]=='+'&&a[4]=='I'&&a[5]=='P'&&a[6]=='D'&&sq){
sq=0;
l=(a[11]>='0'&&a[11]<='9')?(a[10]-48)*10+(a[11]-48):a[10]-48;
if(a[8]-48){
if(l==1){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,1\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==2){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,2\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==3){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,3\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==4){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,4\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==5){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,5\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==6){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,6\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==7){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,7\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==8){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,8\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==9){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,9\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==10){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,10\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==11){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,11\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==12){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,12\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==13){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,13\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==14){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,14\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==15){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,15\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==16){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,16\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==17){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,17\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==18){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,18\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==19){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,19\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else{
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=0,20\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
}
else{
if(l==1){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,1\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==2){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,2\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==3){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,3\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==4){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,4\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==5){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,5\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==6){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,6\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==7){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,7\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==8){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,8\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==9){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,9\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+12);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==10){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,10\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==11){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,11\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==12){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,12\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==13){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,13\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==14){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,14\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==15){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,15\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==16){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,16\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==17){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,17\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==18){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,18\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else if(l==19){
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,19\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
else{
st=0;
ES=0;
TI=1;
printf("AT+CIPSEND=1,20\r\n");
while(!TI);
TI=0;
time();
TI=1;
puts(a+13);
while(!TI);
TI=0;
ES=1;
time();
st=1;
}
}
}
if(a[1]){
OLED_SetPos(0,page);
for(i=1;i<81;i++){
if(a[i]>='0'&&a[i]<='9')
for(j=0;j<6;j++)dat(digital[a[i]-48][j]);
else if(a[i]=='.')
for(j=0;j<6;j++)dat(dt_pls[2][j]);
else if(a[i]>='A'&&a[i]<='Z')
for(j=0;j<6;j++)dat(alpha[a[i]-65][j]);
else if(a[i]>='a'&&a[i]<='z')
for(j=0;j<6;j++)dat(bet[a[i]-97][j]);
else if(a[i]=='+')
for(j=0;j<6;j++)dat(dt_pls[1][j]);
else if(a[i])for(j=0;j<6;j++)dat(0x00);
}
}
switch(scan()){
case 1:
case 3:for(i=1;i<81;i++)a[i]=0;
sq=1;
goto lop;
case 2:for(i=1;i<81;i++)a[i]=0;
OLED_clear();
sq=page=0;
}
}
lop:
page+=2;
if(page==8){
time();time();time();time();time();time();
time();time();time();time();time();time();
OLED_clear();
page=0;
}
}
main(){
TMOD=0x21;
TH1=TL1=0xfd;
TH0=0x4c;
TL0=0xd0;
EA=ET0=ES=SM1=TR1=REN=1;
SM0=TR0=0;
iic_init();
OLED_Init();
wificommand(order1);
wificommand(order2);
wificommand(order3);
wificommand(order4);
wificommand(order5);
wificommand(order6);
time();time();time();time();time();time();
time();time();time();time();time();time();
TR0=1;
page=-2;
OLED_clear();
while(1)doublechat();
}
復(fù)制代碼
0.png
(6.68 KB, 下載次數(shù): 28)
下載附件
2019-8-13 01:32 上傳
全部資料51hei下載地址(有亂碼,謹(jǐn)慎下載):
programme.7z
(10.25 MB, 下載次數(shù): 7)
2019-8-13 01:32 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
成人免费视频观看视频
|
一级免费毛片
|
欧美视频一区二区三区
|
伊人色综合久久久天天蜜桃
|
福利社午夜影院
|
国产精品久久久久久久久久久新郎
|
国内av在线
|
在线视频91
|
69性欧美高清影院
|
美女操网站
|
亚洲+变态+欧美+另类+精品
|
日韩小视频
|
亚洲毛片在线观看
|
国产精品久久av
|
久久黄色精品视频
|
一区二区三区视频
|
亚洲精品中文在线观看
|
成人精品国产一区二区4080
|
日韩不卡一区二区
|
在线色网
|
亚洲欧美久久
|
精品久久久久久中文字幕
|
亚洲品质自拍视频网站
|
国产精品看片
|
欧美性生活网
|
秋霞在线一区二区
|
亚洲精选一区二区
|
久久久久久国产精品免费免费狐狸
|
色爱综合网
|
国产精品污www一区二区三区
|
www操操
|
一级黄色绿像片
|
国产精品日日做人人爱
|
亚洲先锋影音
|
91视视频在线观看入口直接观看
|
日韩一级黄色片
|
91精品在线观看入口
|
狠狠久久综合
|
日日夜夜天天久久
|
精品中文字幕一区
|
亚洲精品一区二区久
|