Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
c66b54a9
Commit
c66b54a9
authored
Feb 05, 2017
by
Ion
Committed by
Me No Dev
Feb 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add touch example
parent
bbf48a5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
libraries/ESP32/examples/Touch/TouchInterrupt/TouchInterrupt.ino
...es/ESP32/examples/Touch/TouchInterrupt/TouchInterrupt.ino
+35
-0
No files found.
libraries/ESP32/examples/Touch/TouchInterrupt/TouchInterrupt.ino
0 → 100644
View file @
c66b54a9
/*
This is un example howto use Touch Intrrerupts
The bigger the threshold, the more sensible is the touch
*/
int
threshold
=
40
;
bool
touch1detected
=
false
;
bool
touch2detected
=
false
;
void
gotTouch1
(){
touch1detected
=
true
;
}
void
gotTouch2
(){
touch2detected
=
true
;
}
void
setup
()
{
Serial
.
begin
(
115200
);
delay
(
1000
);
// give me time to bring up serial monitor
Serial
.
println
(
"ESP32 Touch Interrupt Test"
);
touchAttachInterrupt
(
T2
,
gotTouch1
,
threshold
);
touchAttachInterrupt
(
T3
,
gotTouch2
,
threshold
);
}
void
loop
(){
if
(
touch1detected
){
touch1detected
=
false
;
Serial
.
println
(
"Touch 1 detected"
);
}
if
(
touch2detected
){
touch2detected
=
false
;
Serial
.
println
(
"Touch 2 detected"
);
}
}
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