Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
satsob
/
Robotite_ylesannete_projekt
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c2725043
authored
Oct 06, 2020
by
satsob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IR Sensor
parent
2f0a6a47
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
IR_Sensor/IR_Sensor.ino
IR_Sensor/IR_Sensor.ino
0 → 100644
View file @
c2725043
#include <IRremote.h>
const
int
RECV_PIN
=
2
;
IRrecv
irrecv
(
RECV_PIN
);
decode_results
results
;
void
setup
(){
Serial
.
begin
(
9600
);
irrecv
.
enableIRIn
();
irrecv
.
blink13
(
true
);
}
void
loop
(){
if
(
irrecv
.
decode
(
&
results
)){
//Serial.println(results.value, HEX); // results.value is long unsigned int
//Serial.println(results.decode_type);
irrecv
.
resume
();
}
switch
(
results
.
value
)
{
case
0x707048B7
:
Serial
.
println
(
"Forward"
);
break
;
case
0x7070C837
:
Serial
.
println
(
"Backward"
);
break
;
case
0x707028D7
:
Serial
.
println
(
"Right"
);
break
;
case
0x7070A857
:
Serial
.
println
(
"Left"
);
break
;
}
results
.
value
=
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment