Created
October 1, 2014 18:16
-
-
Save joselynNeon/9adb169dad182540dda9 to your computer and use it in GitHub Desktop.
Arduino Capsense Code
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); | |
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); | |
/*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! | |
long mapCap = map(CapSense1, 0, 900, 0, 10); | |
Serial.print(mapCap, 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