# 7.3 Touch Sensor

## Hardware Wiring

![Touch Sensor](/files/-LCFELpqzxyrwkrQip1d)

## Sketch

The code can be found at [Examples\_Arduino - sensor-kit-for-arduino - \_032\_Touch - \_032\_Touch.ino](https://github.com/LongerVisionRobot/Examples_Arduino/blob/master/sensor-kit-for-arduino/_032_Touch/_032_Touch.ino).

```
int Led=13;       // Define LDE Pin
int buttonpin=3;  // Define pin for touch sensor
int val;          // Define Variable val
void setup()
{
  pinMode(Led,OUTPUT);  // Define LED as output
  pinMode(buttonpin,INPUT); // Define touch sensor as input
}
void loop()
{
  val=digitalRead(buttonpin);// assign digital pin 3's reading to val
  if(val==HIGH) // anything detected by touch sensor, LED starts
  {
    digitalWrite(Led,HIGH);
  }
  else
  {
    digitalWrite(Led,LOW);
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://longer-vision-robot.gitbook.io/arduino-full-stack/07_touch_sensors/032_touch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
