Jacob’s capSense pear led

My video

I kept it very simple and used a pear as my organic material to trigger the led.

Here is my code

#include <CapacitiveSensor.h>
CapacitiveSensor   cs_4_8 = CapacitiveSensor(4,8); // 1M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
void setup()
{
   cs_4_8.set_CS_AutocaL_Millis(0xFFFFFFFF);// turn off autocalibrate on channel 1 – just as an example
   Serial.begin(9600);
   pinMode(7,OUTPUT);
}
void loop()
{
 long sensor1 =  cs_4_8.capacitiveSensor(50);
    Serial.println(sensor1);  // print sensor output
   if(sensor1 >= 1000)
   {
    digitalWrite(7,HIGH);
   }
   else{
    digitalWrite(7,LOW);
   }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s