Arduino Touch sensor switch KY-036

Hello world! Here we go again!… I made another example on one of the sensors i got.
This time i made a example for the KY-036 Arduino Touch sensor.

Schematic:
ky-036 touch sensor, Arduino Touch sensor

Parts list:
Arduino Uno.
3 Color led Module KY-016 (other separate leds will do to)
Touch sensor Module KY-036
Buzzer.
set of Jumper wires MM/FF/MF

Code:

/*
Author: Danny van den brande, Arduinosensors.nl. BlueCore Tech.
In this example we use the KY-036 Touch sensor to turn on a led and buzzer.
 */
int GreenLed = 5;
int BlueLed = 6;
int Buzzer = 7;
int TouchSensor = 3; 
int val;

void setup ()
{
pinMode (GreenLed, OUTPUT);
pinMode (BlueLed, OUTPUT);
pinMode (Buzzer, OUTPUT);
pinMode (TouchSensor, INPUT);
}
void loop ()
{
val = digitalRead (TouchSensor) ;
if (val == HIGH) 
{
digitalWrite (BlueLed, HIGH);
digitalWrite (GreenLed, LOW);
digitalWrite (Buzzer, HIGH);
}
else
{
digitalWrite (BlueLed, LOW);
digitalWrite (GreenLed, HIGH);
digitalWrite (Buzzer, LOW);
}
}
Danny van den Brande

http://www.arduinosensors.nl

Programmer, Game Designer, 3D Designer, Web Designer, Graphic Designer. Jup this website looks crappy.. :) But enjoy the projects! Everything you need is here.

Leave a Reply

Your email address will not be published. Required fields are marked *