1

proteus schematic

#include <Servo.h>
#define potpin A0
int savebutton=2;
int button1=3;
int button2=4;
int button3=5;
Servo servo1;
Servo servo2;
Servo servo3;
int servo1ipos=90; 
int servo2ipos=90;
int servo3ipos=90;
int val=0;
void setup() {
 // put your setup code here, to run once:
 Serial.begin(9600);
 pinMode(savebutton,INPUT);
 pinMode(button1,INPUT);
 pinMode(button2,INPUT);
 pinMode(button3,INPUT);
 servo1.attach(6);
 servo2.attach(7);
 servo3.attach(8);
 servo1.write(servo1ipos);
 servo2.write(servo2ipos);
 servo3.write(servo3ipos);
}
void loop() {
 // put your main code here, to run repeatedly:
 servocontrol();
}
int servocontrol(){
 if(digitalRead(button1)==LOW){
 potvalue();
 Serial.println(val);
 servo1.write(val);
 delay(200);
 }
}
int potvalue(){
 val=analogRead(potpin);
}

Basicly I only read 1023 value instead of potentiometer value I couldnt figure it out need help.

Update: I came up solution by connecting 5V into Arduino's VCC pin.

asked Dec 5, 2021 at 1:20
5
  • I don't know Proteus - does it automagically connect the VCC and GND pins of the Uno to sensible nets? Commented Dec 5, 2021 at 7:42
  • @Mat yes also you can see from voltmeter I can change voltage with potentiometer. Commented Dec 5, 2021 at 12:54
  • @Mat I dont know you mentioned about VCC on arduino but yeah I solve the problem with connecting 5V into Arduino's VCC pin. Thanks. Commented Dec 5, 2021 at 13:14
  • 2
    Please take the tour to learn how this site works. Especially, please don't mark a question with "[SOLVED]", this is not a forum. Instead, write an own answer and mark, after you are allowed to do it. Visitors select answered question after the number of answers and the green mark, not by the title. Commented Dec 5, 2021 at 13:24
  • 1
    Oh, you put your solution as the comment on your edit--that makes it very difficult to see. You should write up your work as an answer, and give yourself a green checkmark for solving your own problem. Or at the very least, copy your edit summary message into your question. Commented Dec 5, 2021 at 15:30

1 Answer 1

1

I came up solution by connecting 5V into Arduino's VCC pin.

answered Dec 5, 2021 at 16:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.