Last active
August 29, 2015 13:59
-
-
Save LucyMatch/10900511 to your computer and use it in GitHub Desktop.
Arduino Sketch Taking in CapSense Values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import the capSense Library | |
#include <CapacitiveSensor.h> | |
//these are the capsense inputs 2 is the common send the second number is the | |
//other digital input the sensor is attached to | |
CapacitiveSensor cs_2_3 = CapacitiveSensor(2,3); | |
CapacitiveSensor cs_2_4 = CapacitiveSensor(2,4); | |
CapacitiveSensor cs_2_5 = CapacitiveSensor(2,5); | |
void setup() { | |
//Begin Serial Communication with a baud rate of 9600 | |
//this must match the serial that you enter into processing/OF | |
Serial.begin(9600); | |
} | |
void loop() { | |
// Store the value input of each sensor in each of these variables | |
long CapSense1 = cs_2_3.capacitiveSensor(30); | |
long CapSense2 = cs_2_4.capacitiveSensor(30); | |
long CapSense3 = cs_2_5.capacitiveSensor(30); | |
/*The Serial.print() doesn't have a space | |
the ',' is used to parse the values in processing | |
the last value does not require the ',' | |
but make sure you have a blank Serial.println(); follwoing it*/ | |
// put into DEC form for parsing in processing | |
//this is how you will get processing to read you sensor inputs and split them up! | |
Serial.print(CapSense1, DEC);Serial.print(","); | |
Serial.print(CapSense2, DEC);Serial.print(","); | |
Serial.print(CapSense3, DEC);Serial.print(","); | |
Serial.println(); | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment