-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroku_fuzz_address.ino
68 lines (59 loc) · 1.51 KB
/
roku_fuzz_address.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
#define AGC 9 //milliseconds
#define AGC_PAUSE 4500 //microseconds
#define PREDROP 625 ///microseconds
#define ZERO 500 //microseconds
#define ONE 1600 //microseconds
#define OUTPIN 10
int address = 0x0000;
byte instruction = 0x78;
void ir_send(int address, byte instruction){
int i;
//send AGC preamble
digitalWrite(OUTPIN, LOW);
delay(AGC);
digitalWrite(OUTPIN, HIGH);
delayMicroseconds(AGC_PAUSE);
//send address
for (i = 15; i >= 0; i--){
digitalWrite(OUTPIN, LOW);
delayMicroseconds(PREDROP);
digitalWrite(OUTPIN, HIGH);
if (bitRead(address,i)) delayMicroseconds(ONE);
else delayMicroseconds(ZERO);
}
//send instruction
for (i = 7; i >= 0; i--){
digitalWrite(OUTPIN, LOW);
delayMicroseconds(PREDROP);
digitalWrite(OUTPIN, HIGH);
if (bitRead(instruction,i)) delayMicroseconds(ONE);
else delayMicroseconds(ZERO);
}
//send inverse instruction
for (i = 7; i >= 0; i--){
digitalWrite(OUTPIN, LOW);
delayMicroseconds(PREDROP);
digitalWrite(OUTPIN, HIGH);
if (bitRead(instruction,i)) delayMicroseconds(ZERO);
else delayMicroseconds(ONE);
}
//Close Final Bit
digitalWrite(OUTPIN, LOW);
delayMicroseconds(PREDROP);
digitalWrite(OUTPIN, HIGH);
}
void setup() {
pinMode(OUTPIN, OUTPUT);
digitalWrite(OUTPIN, HIGH);
}
void loop() {
TXLED1;
ir_send(address, instruction);
delay(40);
//second instruction - instruction + 1
ir_send(address, instruction + 1);
if (address==0xFFFF) exit(0);
else address++;
TXLED0;
delay(60);
}