-
Notifications
You must be signed in to change notification settings - Fork 0
/
RF_test_send_signal.ino
81 lines (67 loc) · 2.74 KB
/
RF_test_send_signal.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <IRremote.h>
IRsend irsend;
void setup()
{
Serial.begin(9600);
}
String getValue(String data, char separator, int index)
{
int found = 0;
int strIndex[] = { 0, -1 };
int maxIndex = data.length();
for (int i = 0; i <= maxIndex && found <= index; i++) {
if (data.charAt(i) == separator || i == maxIndex) {
found++;
strIndex[0] = strIndex[1] + 1;
strIndex[1] = (i == maxIndex) ? i+1 : i;
}
}
return found > index ? data.substring(strIndex[0], strIndex[1]) : "";
}
void loop() {
while (Serial.available()) {
String temp = Serial.readStringUntil('\n');
if(temp=="CHECKRMC"){
Serial.write("Arduino");
break;
}
else {
int sinyal = getValue( temp, ';', 0).toInt();
int bitsayisi = getValue( temp, ';', 1).toInt();
String protokol = getValue( temp, ';', 2);
Serial.println(sinyal);
Serial.println(bitsayisi);
Serial.println(protokol);
if (protokol == "UNKNOWN");
irsend.sendRC5(sinyal, bitsayisi); break ;
if (protokol == "DVT-5277");
irsend.sendRC5(sinyal, bitsayisi); break ;
if (protokol == "INDAY");
irsend.sendNEC(sinyal, bitsayisi); break ;
if (protokol == "Sony");
irsend.sendSony(sinyal, bitsayisi); break ;
if (protokol == "RC5");
irsend.sendRC5(sinyal, bitsayisi); break ;
if (protokol == "HUMAX(RM-301)");
irsend.sendNEC(sinyal, bitsayisi); break ;
if (protokol == "DISH");
irsend.sendDISH(sinyal, bitsayisi); break ;
if (protokol == "D-SMART");
irsend.sendNEC(sinyal, bitsayisi); break ;
// if (protokol == "JVC");
// irsend.sendJVC(sinyal, bitsayisi); break ;
if (protokol == "Digiturk");
irsend.sendRC5(sinyal, bitsayisi); break ;
if (protokol == "isimsiz");
irsend.sendRC5(sinyal, bitsayisi); break ;
if (protokol == "SAMSUNG") ;
irsend.sendSAMSUNG(sinyal, bitsayisi); break ;
if (protokol == "HUMAX")
irsend.sendNEC(sinyal, bitsayisi); break ;
if (protokol == "Apple")
irsend.sendNEC(sinyal, bitsayisi); break ;
// if (protokol == "PANASONIC"):
// irsend.sendPanasonic(sinyal, bitsayisi); break ;
}
}
}