#include <Arduino.h>
#include <Microduino_Key.h>
#include <IRremote.h>
AnalogKey keyAnalog2[5] {(A2),(A2),(A2),(A2),(A2)};
IRsend irsend;
void setup()
{
Serial.begin(9600);
for (uint8_t a = 0; a < 5; a++)
{
keyAnalog2[a].begin(INPUT);
}
}
void loop()
{
delay(0.2*1000);
if((keyAnalog2[1].readVal(700 - 50, 700 + 50,KEY_PRESSING)))
{
irsend.sendRC5(1,32);
Serial.println("up");
}
if((keyAnalog2[2].readVal(330 - 50, 330 + 50,KEY_PRESSING)))
{
irsend.sendRC5(2,32);
Serial.println("down");
}
if((keyAnalog2[3].readVal(512 - 50, 512 + 50,KEY_PRESSING)))
{
irsend.sendRC5(3,32);
Serial.println("right");
}
if((keyAnalog2[4].readVal(860 - 50, 860 + 50,KEY_PRESSING)))
{
irsend.sendRC5(4,32);
Serial.println("right");
}
if((keyAnalog2[3].readVal(512 - 50, 512 + 50,KEY_PRESSING)))
{
irsend.sendRC5(5,32);
Serial.println("center");
}
}
1. mproject
编程语言: C/C++(Arduino)
软件工具:mDesigner 3
2. mproject
编程语言: C/C++(Arduino)
软件工具:mDesigner 3
立即注册