Arduino tutorial | How to use the Arduino UNO board to decode ?
由 huangdaisy 在 发布
How to use the Arduino UNO board to decode the standard 433MHZ and 315MHZ signals and display them in hexadecimal?
Required materials:
Arduino UNO board, 1602A display, buzzer, adjustable resistance, QIACHIP RX18210A receiving module, DuPont cable, data cable.
Wiring notes:
Number | Wiring symbol | Pin wiring |
1 | VSS | Ground |
2 | VDD | 5 v |
3 | RS | Arduino data terminal |
4 | R/W | Ground Read and write signals |
5 | E | Arduino data terminal |
6 | BLA | 5 v |
7 | BLK | Ground |
8 | D4 | Arduino data terminal |
9 | D5 | Arduino data terminal |
10 | D6 | Arduino data terminal |
11 | D7 | Arduino data terminal |
12 | VO | The middle pin of the third pin of the adjustable resistor |
13 | Buzzer positive pin | Arduino data terminal |
14 | QIACHIP RX18210A receiving module DAT pin | Arduino data terminal |
Arduino decoding code:
#include<RCSwitch.h>
#include <LiquidCrystal.h>
const int rs=13,en=5,d4=8,d5=9,d6=10,d7=11;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
RCSwitch mySwitch=RCSwitch();
void setup() {
pinMode(3,OUTPUT);
lcd.begin(16,2);
mySwitch.enableReceive(0);
}
void loop() {
if (mySwitch.available()){
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("receive:");
lcd.print(mySwitch.getReceivedValue(),HEX);
if(mySwitch.getReceivedProtocol()==1){
lcd.setCursor(0,2);
lcd.print("Protocol:EV1527");
}
digitalWrite(3,HIGH);
delay(500);
digitalWrite(3,LOW);
mySwitch.resetAvailable();}
}