Arduino type: Arduino UNO Via "The Arduino Starter Kit"
Arduino IDE code: 1.0.5 Primary/1.5.2 troubleshooting/ 0022 Alpha troublshooting
Code trying to compile: Project 13 from Arduino Projects book
#include <CapacitiveSensor.h>
CapacitiveSensor capSensor = CapacitiveSensor(4,2);
int threshold = 1000;
const int ledPin = 12;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
long sensorValue = capSensor.capacitiveSensor(30);
Serial.println(sensorValue);
if(sensorValue > threshold) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
delay(10);
}
Error being received
p13:2: error: 'CapacitiveSensor' does not name a type
p13.ino: In function 'void loop()':
p13:10: error: 'capSensor' was not declared in this scope
I'm not the only person getting this issue for the class that I'm doing this for. I'm looking for a solution to this problem. I'm not a debugger, so trying to do that isn't feasible for me. I did follow instructions on how to install the library (Arduino Playground - HomePage) and even the example code errors out.
Example error code:
CapacitiveSensorSketch:12: error: 'CapacitiveSensor' does not name a type
CapacitiveSensorSketch:13: error: 'CapacitiveSensor' does not name a type
CapacitiveSensorSketch:14: error: 'CapacitiveSensor' does not name a type
CapacitiveSensorSketch.pde: In function 'void setup()':
CapacitiveSensorSketch:18: error: 'cs_4_2' was not declared in this scope
CapacitiveSensorSketch.pde: In function 'void loop()':
CapacitiveSensorSketch:25: error: 'cs_4_2' was not declared in this scope
CapacitiveSensorSketch:26: error: 'cs_4_6' was not declared in this scope
CapacitiveSensorSketch:27: error: 'cs_4_8' was not declared in this scope
It looks like the IDE just does not have the type for capsense at all. What will I need to do to fix this?