Touch Activated Servo

Hey, hopefully someone can give me a hand with this coding issue I have. I am trying to program the arduino so when the touch sensor is pressed, it will turn on a servo motor and make it turn 180 degrees. Right now it feels like the motor is fighting to move, but just won't go.
This is my code so far:

#include <Servo.h>
Servo motor1;

int touchPin = 6;
int servo = 8;
int value = 0;
int angle = 0;

void setup() {
motor1.attach(8);
Serial.begin(9600);
pinMode(touchPin, INPUT);
pinMode(servo, OUTPUT);
}

void loop() {
if (digitalRead(touchPin)==HIGH) {
angle == 180;
motor1.write(angle);

}

else if (digitalRead(touchPin)==LOW){
angle == 0;
motor1.write(angle);

}
value = digitalRead(touchPin);
digitalWrite(servo, value);

}

There is a smiley with sun glasses in your code....

Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

Once this is done clarify

  • what is on pin 6
  • how things are wired/powered
  • what the hell do you expect from
value = digitalRead(touchPin);
digitalWrite(servo, value);
 value = digitalRead(touchPin);
  digitalWrite(servo, value);

Why ?

Hi and welcome to the forum.
You need to read through the How to use this forum - please read sticky post located at the top of this and every forum here.
It covers many valuable items, including how to post code using the code tags.
Go read it.
Come back and edit your post.

If you are having difficulties with servos, I want to know how you are powering the servo?
Should be from a separate source, NOT the arduino 5v pin.
If the servo is small, and unloaded, you can some times get away with using the 5v. But it is much better to keep it separate. Make the grounds common.

Also if you are having problems, try the weep tutorial.
(and note that the sweep tutorial does not declare the servo pin an output and does not digitalWrite to the servo pin)

You apparently have a servo which is called motor1 on pin 8 and something else called servo which is also on pin8 and which for some reason you write HIGH and LOW to.

I have no idea what you're trying to do.

Steve

      angle == 180;

That is NOT the assignment operator.