首页/作品列表/mCookie红外遥控点阵屏
mCookie红外遥控点阵屏
2020 0
主要内容
#include
#include
#include
AnalogKey keyAnalog6[5] {(A6),(A6),(A6),(A6),(A6)};

IRsend irsend;

void setup()
{
Serial.begin(9600);
for (uint8_t a = 0; a < 5; a++)
{
keyAnalog6[a].begin(INPUT);
}


}

void loop()
{
delay(0.5*1000);
if((keyAnalog6[1].readVal(700 - 50, 700 + 50,KEY_PRESSING)))
{
irsend.sendRC5(1,32);
Serial.println("up");

}
if((keyAnalog6[2].readVal(330 - 50, 330 + 50,KEY_PRESSING)))
{
irsend.sendRC5(2,32);
Serial.println("down");

}
if((keyAnalog6[3].readVal(512 - 50, 512 + 50,KEY_PRESSING)))
{
irsend.sendRC5(3,32);
Serial.println("right");

}
if((keyAnalog6[4].readVal(860 - 50, 860 + 50,KEY_PRESSING)))
{
irsend.sendRC5(4,32);
Serial.println("left");

}
if((keyAnalog6[3].readVal(512 - 50, 512 + 50,KEY_PRESSING)))
{
irsend.sendRC5(5,32);
Serial.println("center");

}

}
#include
#include

#include
int var_x;

int var_y;

int var_old x;

int var_old y;

long ir_item;
IRrecv irrecv_2(2);
decode_results results_2;
uint32_t _irData = 0x00000000;
uint32_t _irDataCache = 0x00000000;
uint32_t dump(decode_results *results)
{
int count = results->rawlen;
if (results->decode_type == UNKNOWN)
{
}
else
{
if (results->decode_type == NEC)
{
}
_irDataCache = _irData;
if (results->value == 0xFFFFFFFF)
{
_irData = _irDataCache;
}
else
{
_irData = results->value;
}
}
}
uint32_t _irTime = 0;
uint32_t irFluse()
{
if (irrecv_2.decode(&results_2))
{
dump(&results_2);
irrecv_2.resume();
_irTime = millis();
}
if (millis() - _irTime > 200)
{
_irData = 0x00000000;
}
return _irData;
}
uint8_t Addr[MatrixPix_X][MatrixPix_Y] =
{
{
64
}
}
;
Matrix display = Matrix(Addr, TYPE_COLOR);


void setup()
{
Serial.begin(9600);
Serial.begin(9600);

irrecv_2.enableIRIn();
Wire.begin();

var_x=0;
var_y=0;

}

void loop()
{
var_command=irFluse();
Serial.println(var_command);
var_old x=var_x;
var_old y=var_y;
if(((var_command) == 1))
{
var_y=(var_y)-1;

}
if(((var_command) == 2))
{
var_y=(var_y)+1;

}
if(((var_command) == 3))
{
var_x=(var_x)-1;

}
if(((var_command) == 4))
{
var_x=(var_x)+1;

}
if(((var_command) == 5))
{
var_x=0;
var_y=0;

}
display.setLedColor(var_old x, var_old y, (0x000000)>>16, (0x000000)>>8&0xFF, (0x000000)&0xFF);
display.setLedColor(var_x, var_y, (0xfd1c1c)>>16, (0xfd1c1c)>>8&0xFF, (0xfd1c1c)&0xFF);
delay(0.2*1000);

}

代码展示

1. 发射

编程语言: C/C++(Arduino)

软件工具:mDesigner 3


2. 接受

编程语言: C/C++(Arduino)

软件工具:mDesigner 3


附件下载
  • 资料展示
  • 2019110115-李怡.zip
  • QQ视频20191209211733.zip
0
大牛,别默默的看了,快登录帮我点评一下吧!

立即注册