Created
August 20, 2019 21:17
-
-
Save minamiss/839012e158b0c747a2c0b209ec26b21f 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> | |
int pin5=5; | |
int pin3=3; | |
CapacitiveSensor cs_3_2 = CapacitiveSensor(3,2); | |
void setup() { | |
cs_3_2.set_CS_AutocaL_Millis(0xFFFFFFFF); | |
Serial.begin(9600); | |
pinMode(pin5,OUTPUT); | |
pinMode(pin3,OUTPUT); | |
} | |
void loop() { | |
long start = millis(); | |
long total1 = cs_3_2.capacitiveSensor(30); | |
Serial.println(total1); | |
digitalWrite(pin3,HIGH); | |
delay(5000); | |
digitalWrite(pin3,LOW); | |
delay(100); | |
if(total1>300){ | |
digitalWrite(pin5,HIGH); | |
// digitalWrite(pin3,LOW); | |
delay(1000); | |
digitalWrite(pin5,LOW); | |
// digitalWrite(pin3,HIGH); | |
delay(100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment