Pages: [1]   Go Down
Author Topic: Native Capacitive Touch - Arduino Nano  (Read 1045 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 2
Posts: 711
a, b = b, a+b
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Hi Everyone

I am playing around with the native capacitive touch function I found here: http://playground.arduino.cc//Code/CapacitiveSensor

I am using an arduino Nano with 8 analogue Inputs. For A6 and A7 the only reading I get is 17. The two pins appear to simply do nothing at all. I guess this might be an issue of the portmanipulation and bit-math which is going on in the function, but its really beyond my programming skills.

Does anyone know what the problem might be and how to fix it?

Thanks

p.
Logged


Offline Offline
God Member
*****
Karma: 2
Posts: 711
a, b = b, a+b
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

here is my code, though I doubt that is the issue:

Code:

void setup() {
  Serial.begin(9600);
}


void loop() {
  
  Serial.print(readCapacitivePin(A0));
  Serial.print(", ");
    Serial.print(readCapacitivePin(A1));
    Serial.print(", ");
    Serial.print(readCapacitivePin(A2));
   Serial.print(", ");
    Serial.print(readCapacitivePin(A3));
  Serial.print(", ");
    Serial.print(readCapacitivePin(A4));
  Serial.print(", ");
    Serial.print(readCapacitivePin(A5));
  Serial.print(", ");
    Serial.print(readCapacitivePin(A6));
  Serial.print(", ");
    Serial.print(readCapacitivePin(A7));
  Serial.println("");
  
  

  delay(1);        // delay in between reads for stability
}


The output on my serial console looks something like this:

Code:
2, 2, 1, 2, 2, 1, 17, 17
2, 2, 1, 2, 2, 1, 17, 17
2, 2, 1, 2, 2, 1, 17, 17
2, 2, 1, 2, 2, 1, 17, 17
2, 2, 1, 1, 2, 1, 17, 17
2, 2, 1, 2, 2, 1, 17, 17
2, 2, 1, 1, 2, 1, 17, 17
2, 2, 1, 1, 2, 1, 17, 17
2, 2, 1, 1, 2, 1, 17, 17
2, 2, 1, 1, 2, 1, 17, 17
2, 2, 1, 1, 2, 1, 17, 17
2, 2, 1, 1, 2, 1, 17, 17

If I touch a sensor, it looks like this:

Code:
2, 2, 1, 9, 2, 1, 17, 17
2, 2, 1, 9, 2, 1, 17, 17
2, 2, 1, 10, 2, 1, 17, 17
2, 2, 1, 8, 2, 1, 17, 17
2, 2, 1, 9, 2, 1, 17, 17
2, 2, 1, 10, 2, 1, 17, 17
2, 2, 1, 9, 2, 1, 17, 17
2, 2, 1, 6, 2, 1, 17, 17
2, 2, 1, 9, 2, 1, 17, 17
2, 2, 1, 7, 2, 1, 17, 17
2, 2, 1, 9, 2, 1, 17, 17
2, 2, 1, 8, 2, 1, 17, 17
2, 2, 1, 7, 2, 1, 17, 17
Logged


Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

pins A6 and A7 r no digital pins, IIRC...
they r just connected to the ADC MUX...
Logged

-Arne

Offline Offline
God Member
*****
Karma: 2
Posts: 711
a, b = b, a+b
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Brunsbuettel... wie schoen :-D

Yep - I was afraid of that. I didnt realize those two pins dont work that way until I had all my project soldered and cabled :-S .... if I had known in advance, I would have just used a mega. oh well...
Logged


Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

u can use other pins?
or did u already use them all?
Logged

-Arne

Offline Offline
God Member
*****
Karma: 2
Posts: 711
a, b = b, a+b
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

wait. they dont need to be analogue pins, do they ... maybe I can :-D *facepalm*
Logged


Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

LOL  smiley-lol
Logged

-Arne

Pages: [1]   Go Up
Jump to: