Pages: [1]   Go Down
Author Topic: Project 13, library error!  (Read 1101 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't really use the CapacitiveSensor header.

Here's my code (copied from the book):

Code:
#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.print(sensorValue);
 
 
 if(sensorValue > threshold){
   digitalWrite(ledPin, HIGH);
 }
 else{
   digitalWrite(ledPin, LOW);
 }
 delay(10);
 
}

So, two questions:

1. How can I fix the header bug, so that Arduino recognizes this: "#include <CapacitiveSensor.h>"?

2. Do I need to hook the sensor wire to something specific provided in the Starter Kit, or can I connect it to anything conductive?



Thanks in advance!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to install a library. Read the instruction in the paragraph labeled "Preparing the library" on page 137.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thx!
Logged

Pages: [1]   Go Up
Jump to: