Hi all, this issue I'm having is shared with numerous other posters. Unfortunately those threads are locked/archived so I cant revive them. The issue Im having is of the same nature as users bobob and gvarvind found in the following thread:
http://forum.arduino.cc/index.php?topic=188109.0
Anyway, can anybody explain to me why the library function CapacitiveSensorDue returns -1?
I did do some investigation work which may guide your advice. I opened up the library code to see under what conditions it returns -1. The conditions happened to be, namely:
//code....
if (error < 0) return -1; // bad pin
//code
if (error < 0) return -1; // bad pin - this appears not to work
//code
Upon reading this, one would naturally ask what causes an error to be less than 0 to activate those conditions. These states are declared as follows:
#ifdef NUM_DIGITAL_PINS
if (sendPin >= NUM_DIGITAL_PINS) error = -1;
if (receivePin >= NUM_DIGITAL_PINS) error = -1;
#endif
Note that when I used the CapacitiveSensorDue function, I loaded the parameters as follows:
CapacitiveSensorDue(8,9);
I have thus hit a paradox. The library is saying that either, or both, the send and recieve pins (8 and 9 respectively) is greater than the number of digital pins on the Arduino Due, which is factually incorrect as the number of pins on the Due, is clearly, well over 50.
Can anyone explain this paradox?