if
((touchstatus
&
(1<<j)))
touc+;
}
if
(touchNumber
==
1)
{
if
(touchstatus
&
(1<<SEVEN))
{
digits
=
'7';
}
else
if
(touchstatus
&
(1<<FOUR))
{
digits
=
'4';
}
else
if
(touchstatus
&
(1<<ONE))
{
digits
=
'1';
}
else
if
(touchstatus
&
(1<<EIGHT))
{
digits
=
'8';
}
else
if
(touchstatus
&
(1<<FIVE))
{
int touchNumber = 0;
uint16_t touchstatus;
char digits;
touchstatus = getTouchStatus();
for (int j=0; j<12; j++) // Check how many electrodes were pressed
{
The loop function is actually empty currently, as the button presses use the interrupt we created in
the setup loop. If you did have additional hardware you wanted to incorporate into your project, the
code for it can live in this loop.
The last two functions in the example code tell the Arduino to check the electrode states for a button
press and what to print out when a button press is detected.
void getNumber()
{
digits = '5';
}
else if (touchstatus & (1<<TWO))
{
digits = '2';
}
else if (touchstatus & (1<<NINE))
{
digits = '9';
}
else if (touchstatus & (1<<SIX))
{
digits = '6';
}
else if (touchstatus & (1<<THREE))
{
digits = '3';
}
Serial.println(digits);
}
w w w . e k t
2
. c o m
Electronics
Katrangi
Trading