Created
April 12, 2019 04:44
-
-
Save minamiss/fe5cf7e985b4c9d69a5e263570c91d15 to your computer and use it in GitHub Desktop.
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
#include <CapacitiveSensor.h> | |
CapacitiveSensor cs_one = CapacitiveSensor(2,3); | |
CapacitiveSensor cs_two = CapacitiveSensor(8,9); | |
CapacitiveSensor cs_three = CapacitiveSensor(10,11); | |
int blue= 5; | |
int white= 6; | |
int yellow =7; | |
void setup() { | |
cs_one.set_CS_AutocaL_Millis(0xFFFFFFFF); | |
cs_two.set_CS_AutocaL_Millis(0xFFFFFFFF); | |
cs_three.set_CS_AutocaL_Millis(0xFFFFFFFF); | |
Serial.begin(9600); | |
pinMode(blue,OUTPUT); | |
pinMode(yellow,OUTPUT); | |
pinMode(white,OUTPUT); | |
} | |
void loop() { | |
long start = millis(); | |
long first = cs_one.capacitiveSensor(30); | |
long second = cs_two.capacitiveSensor(30); | |
long third = cs_three.capacitiveSensor(30); | |
//Serial.println(first); | |
// Serial.println(second); | |
Serial.println(third); | |
if(first>100){ | |
digitalWrite(blue,HIGH); | |
delay(10); | |
} else{ | |
digitalWrite(blue,LOW); | |
} | |
if(second>100){ | |
digitalWrite(white,HIGH); | |
delay(10); | |
}else{ | |
digitalWrite(white,LOW); | |
} | |
if(third>100){ | |
digitalWrite(yellow,HIGH); | |
delay(10); | |
}else{ | |
digitalWrite(yellow,LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment