Capacitive Touch Sensor with Arduino use as a Toggle Switch
ฝัง
- เผยแพร่เมื่อ 10 พ.ค. 2024
- In this small project, I have demonstrated, How you can use a capacitive touch sensor with an Arduino to make a toggle touch switch.
For more details and code you can visit the project page link at circuitmagic.com
Project Page link: coming soon
I have used:
1. Arduino UNO
2. TTP22301 Touch Sensor
3. Jumper Wires
4. LED - วิทยาศาสตร์และเทคโนโลยี
Nice work!
جميل جدا احسنتم العمل
NICE
Good
Please share the code link
Where is the code link plz share
Hi ! what are the components used to make a portatree
yes
It work in nano
Yes
Code link plz
Please add project page link.
tomorrow I will add the link
Here is the code --
int LEDState = 0;
int touchInput = 2;
int inputState;
int lastInputState = 1;
int LEDPin = 13; // Define the LED pin
void setup() {
Serial.begin(9600);
pinMode(LEDPin, OUTPUT);
pinMode(touchInput, INPUT);
}
void loop() {
inputState = digitalRead(touchInput);
if (lastInputState == 0 && inputState == 1) {
if (LEDState == 0) {
digitalWrite(LEDPin, HIGH);
LEDState = 1;
Serial.println("Touch detected. LED turned ON.");
} else {
digitalWrite(LEDPin, LOW);
LEDState = 0;
Serial.println("Touch detected. LED turned OFF.");
}
}
lastInputState = inputState;
delay(100); // Adjust the delay as needed
}
I dont think your code is right.. lastprevioustate=0
Where is the coding
what the fuck?
where is coding??????