Capacitive touch senosor example
parent
32c620aec6
commit
2fd8eb06bb
Binary file not shown.
After Width: | Height: | Size: 173 KiB |
@ -1,24 +1,30 @@
|
||||
/*
|
||||
This is a simple program that reads the capacitive touch sensor on pin4. If it is a low enough value
|
||||
it will light up the builtin LED.
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
#include <foo.h>
|
||||
|
||||
#define LED_BUILTIN 2
|
||||
int delayTime = 1000;
|
||||
int delayTime = 100;
|
||||
int read_value = 100;
|
||||
|
||||
void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
Serial.begin(115200);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// put your main code here, to run repeatedly:
|
||||
Serial.println("Starting loop");
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
delay(delayTime);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
Serial.println("Turning off LED");
|
||||
printf("This is main3.cpp!\n");
|
||||
read_value = touchRead(4);
|
||||
Serial.println(touchRead(4));
|
||||
if (read_value < 10)
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
}
|
||||
delay(delayTime);
|
||||
}
|
Loading…
Reference in New Issue