}
The function
getTouchStatus()
actually returns at 16-bit value which gives the status of each button.
The status of 1 indicates that an electrode is being activated.
language:
c
int
getTouchStatus()
{
int
touch;
touch
=
mpr121Read(0x01)
<<
8;
touch
|=
mpr121Read(0x00);
return
touch;
}
Now that you have basic communication up and running with your shield, you can start integrating
this into projects. If you haven’t yet connected anything to electrodes 9, 10 and 11, consider adding in
additional buttons here. You will also need to update the code. You’ll want to add the following block
of code into the example sketch right beforeSerial.println(digits);. You can change the digits values to
have the buttons output different values instead of “A”, “B”, or “C”.
else
if
(touchstatus
&
(1
<<
ELE9))
{
digits
=
'A';
}
else
if
(touchstatus
&
(1
<<
ELE10))
{
digits
=
'B';
}
else
if
(touchstatus
&
(1
<<
ELE11))
{
digits
=
'C';
//do nothing if more than one button is pressed, or if all are released
else if (touchNumber == 0)
;
else
;
}
How to open Software:
-
Enter to http://www.ekt2.com/products/productdetails?ProductId=9D9859E9-9FF2-4479-
8FBC-4D3EE47E0396
-
Press the icon to start the download
w w w . e k t
2
. c o m
Electronics
Katrangi
Trading