Hi everyone,
we are using an Artemis RedBoard and the CapacitiveSensor library. When trying to program the example code called p13_TouchSensorLamp we get the following error:
'In file included from C:\Users\silvi\AppData\Local\Temp\arduino_modified_sketch_781147\p13_TouchSensorLamp.ino:26:
C:\Users\silvi\Documents\Arduino\libraries\arduino-libraries-CapacitiveSensor-a07209f/CapacitiveSensor.h:239:2: error: 'IO_REG_TYPE' does not name a type
IO_REG_TYPE sBit; // send pin's ports and bitmask
^~~~~~~~~~~
C:\Users\silvi\Documents\Arduino\libraries\arduino-libraries-CapacitiveSensor-a07209f/CapacitiveSensor.h:240:11: error: 'IO_REG_TYPE' does not name a type
volatile IO_REG_TYPE *sReg;
^~~~~~~~~~~
C:\Users\silvi\Documents\Arduino\libraries\arduino-libraries-CapacitiveSensor-a07209f/CapacitiveSensor.h:241:2: error: 'IO_REG_TYPE' does not name a type
IO_REG_TYPE rBit; // receive pin's ports and bitmask
^~~~~~~~~~~
C:\Users\silvi\Documents\Arduino\libraries\arduino-libraries-CapacitiveSensor-a07209f/CapacitiveSensor.h:242:11: error: 'IO_REG_TYPE' does not name a type
volatile IO_REG_TYPE *rReg;
^~~~~~~~~~~
exit status 1
Error compiling for board SparkFun RedBoard Artemis.'
How can we solve this problem?
Thanks to whoever can help
Please first of all read the sticky so you know how to properly post code, and then post all the missing information. The problem is quite certainly in the part you didn't post (e.g. the complete sketch you use).
Or maybe this library is simply not compatible with this Redboard. Check the documentation.
Thank you for pointing out the tags to use for posting code, I will definitely do it from now on.
The code used in the sketch is an example code, which can be found below, is an example sketch so I guess it is possible that the error is in the compatibility between board and library. Is there any way to figure that out?
Thank you again
#include <CapacitiveSensor.h>
/*
* CapitiveSense Library Demo Sketch
* Paul Badger 2008
* Uses a high value resistor e.g. 10M between send pin and receive pin
* Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.
* Receive pin is the sensor pin - try different amounts of foil/metal on this pin
*/
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
CapacitiveSensor cs_4_6 = CapacitiveSensor(4,6); // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil
CapacitiveSensor cs_4_8 = CapacitiveSensor(4,8); // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
void setup()
{
cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
Serial.begin(9600);
}
void loop()
{
long start = millis();
long total1 = cs_4_2.capacitiveSensor(30);
long total2 = cs_4_6.capacitiveSensor(30);
long total3 = cs_4_8.capacitiveSensor(30);
Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug windown spacing
Serial.print(total1); // print sensor output 1
Serial.print("\t");
Serial.print(total2); // print sensor output 2
Serial.print("\t");
Serial.println(total3); // print sensor output 3
delay(10); // arbitrary delay to limit data to serial port
}