toggle

can anybody help me i want to make a toggle servo button to make my sevo go from 180 to 110 degrees when i press once and when i press the same button again make it go from 110 to 180 does anyone have a code and a diagram for that?

We try to help people when they run into problems not supply the code and schematic.
What have you tried!

.

well i am fairly new to arduino i made it go from 180 to 110 degrees that is what i need but i want it to go to one of the to when i press the button i don’t know how to do that

#include <Servo.h>
Servo servo1;

void setup()
{
servo1.attach(9);
servo1.write(180);
delay (1000);

servo1.write(10);
delay (1000);

servo1.write(180);
delay(1000);

}

void loop() {

}

Start by looking at and understanding the change in state example.
This will help you understand switches.

.

so i did the tutorial but i have a hard time figgering out how the code works becous again i am verry new to the arduino

dutch4years:
so i did the tutorial but i have a hard time figgering out how the code works becous again i am verry new to the arduino

It will be much easier to help if you explain what part of the code you don’t understand.

Also, please post the program you are using so we can be sure we are all looking at the same thing.

…R

dutch4years:
so i did the tutorial but i have a hard time figgering out how the code works becous again i am verry new to the arduino

You will remain new until you learn.
And you can learn by going through any of the many free tutorials you can find online.
You will be able to accomplish your goal much faster by putting in a little effort than waiting around for someone to do it for you.

Also, 110 =/= 10, so for future reference, be more precise in explaining yourself.