Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions examples/touch_to_open/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# touch_to_open

touch the touch senso to make the servo move 90 degree

## Hardware Required

* Arduino Board
* Servo Motor
* Hook-up wires
* touch sensor

## Circuit

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the board. The signal pin is typically yellow, orange or white and should be connected to pin 9 on the board.

![](images/Touch_to_open_BB.JPG)

(Images developed using Fritzing. For more circuit examples, see the [Fritzing project page](http://fritzing.org/projects/))

## Schematic

![](images/Touch_to_open_schem.JPG)




Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions examples/touch_to_open/touch_to_open.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <Servo.h> //including the servo library

Servo touch_servo; // initialize a sevo object to use it
int sensor_pin =2; // defining a pin for the touch sensor

void setup() {
pinMode(2, INPUT);
touch_servo.attach(9); // defining the pin of the servo motor(pin9)
Serial.begin(9600); // defining the Baud Rate to use the serial Monitor
}

void loop() {

if (digitalRead(2) == HIGH) // checking if the sensor is touched
{
touch_servo.write(90); // moving the servo 90 degree
Serial.println("Sensor is touched | servo is opened");
}


}