ขาย พร้อมส่ง-5V IR Infrared Remote Decoder Encoding Transmitter&Receiver Wireless Module For Arduino ราคาที่ดีที่สุด
5
4
การให้คะแนน
13
ขายแล้ว
฿180
58% OFF
฿75
ยี่ห้อ | No Brand(ไม่มียี่ห้อ) |
---|---|
เรือจาก | จังหวัดเพชรบูรณ์ |
รายละเอียดสินค้า
พร้อมส่ง-5V IR Infrared Remote Decoder Encoding Transmitter&Receiver Wireless Module For Arduino
Parameters:
1. Specification: 27x17 mm.
2. supply voltage: 5V
3. Communication: Serial communication (TTL level)
4. firing distance: 6-8 meters (OUR actual environmental testing 8 meters Stability Control)
5. Version: 3.02
Function:
1. with the infrared emission features.
2. with infrared encoding.
3. with the infrared emission head expansion interface.
4. with serial communication functions, communication level is TTL.
5. can control 99% of the infrared format devices,
including televisions, fans and other electrical and electronic equipment.
6. support for encoding chips :( typical encoding chips such as uPD6121, uPD6122, TC9012 and numerous
compatible chip model, such as the PT2221, PT2222, SC6121, SC6122, SC9012, etc.)
7. can be used as an infrared wireless data communication, data transmission, control and other functions IR
Applications:
Smart home, student electronic design, infrared turn wireless, intelligent industrial equipment, MP3 controller, IR remote control, IR decoding equipment, electronic building blocks kit, electronic equipment control, infrared wireless switch design, coding equipment intelligent infrared remote control car.
//Code for No.1 IR-Transmitter
int led =2; // Built-in LED for NodeMCU V2/V3
int incomingByte = 0; // for incoming serial data
String IRstring = "";
void setup() {
pinMode(led, OUTPUT); // Initialize the LED_BUILTIN pin as an output
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
digitalWrite(led, HIGH); // Turn the LED off
}
void loop() {
checkIRreceived();
}
//#function
void checkIRreceived() {
if (Serial.available() > 0) {
IRstring = "";
for (int i=0; i <= 2; i++){
incomingByte = Serial.read();
if (incomingByte > 0){
if (incomingByte < 15) {
//Serial.print("0");
//Serial.print(incomingByte, HEX);
IRstring = IRstring+"0"+String(incomingByte,HEX);
} else
{
//Serial.print(incomingByte, HEX);
IRstring = IRstring+String(incomingByte,HEX);
}
} else
{
//Serial.print("00");
IRstring = IRstring+"00";
}
delay(2);
}
//Serial.println("");
Serial.print("IRstring = ");
Serial.println(IRstring);
if (IRstring == "00ff16") {
digitalWrite(led, HIGH); // Turn the LED off by making the voltage HIGH
Serial.println("LED OFF");
delay(500);
uint8_t IR_serial_bytes[5]={0xA1, 0xF1, 0x00, 0xff, 0x18};
Serial.write(IR_serial_bytes,sizeof(IR_serial_bytes));
delay(100);
}
if (IRstring == "00ff0c") {
digitalWrite(led, LOW); // Turn the LED on
Serial.println("LED ON");
delay(500);
uint8_t IR_serial_bytes[5]={0xA1, 0xF1, 0x00, 0xff, 0x5e};
Serial.write(IR_serial_bytes,sizeof(IR_serial_bytes));
delay(100);
}
}
}
//Code for No.2 IR-Receiver
int led =2; // Built-in LED for NodeMCU V2/V3
int incomingByte = 0; // for incoming serial data
String IRstring = "";
void setup() {
pinMode(led, OUTPUT); // Initialize the LED_BUILTIN pin as an output
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
digitalWrite(led, HIGH); // Turn the LED off
}
void loop() {
checkIRerceived();
}
//#function
void checkIRerceived() {
if (Serial.available() > 0) {
IRstring = "";
for (int i=0; i <= 2; i++){
incomingByte = Serial.read();
if (incomingByte > 0){
if (incomingByte < 15) {
//Serial.print("0");
//Serial.print(incomingByte, HEX);
IRstring = IRstring+"0"+String(incomingByte,HEX);
} else
{
//Serial.print(incomingByte, HEX);
IRstring = IRstring+String(incomingByte,HEX);
}
} else
{
//Serial.print("00");
IRstring = IRstring+"00";
}
delay(2);
}
//Serial.println("");
Serial.print("IRstring = ");
Serial.println(IRstring);
if (IRstring == "00ff18") {
digitalWrite(led, HIGH); // Turn the LED off by making the voltage HIGH
Serial.println("LED OFF");
delay(10);
}
if (IRstring == "00ff5e") {
digitalWrite(led, LOW); // Turn the LED on
Serial.println("LED ON");
delay(10);
}
}
}