The Idea: I need to make a start/stop button for the code, and control my servo with 90 dgree by using POT
I used Eagle to design my board
you can learn more about Eagle here
and I used Hello echo board

int sensorValue = analogRead(A0);
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
int sensorValue = analogRead(A0);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(sensorValue); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(sensorValue); // wait for a second
}
#define pb 2
#define pb1 3
#define buz 11
int count=0;
void setup()
{
pinMode(pb,INPUT_PULLUP);
pinMode(pb1,INPUT_PULLUP);
pinMode(buz,OUTPUT);
}
void loop()
{
if(digitalRead(pb)==LOW)
{
delay(10);
while(digitalRead(pb)==LOW);
count++;
if(count==2) count=0;
}
if(digitalRead(pb1)==LOW&&count==true)
{
delay(10);
digitalWrite(buz,HIGH);
}else digitalWrite(buz,LOW);
}
Note
: This circuit is for both input and output, but what interests us here is the input, which is represented here by the POT



all documents here